mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Make MOCK_SIGNATURE macro shorter
Put most of it into a template-alias as this may turn up in error messages
This commit is contained in:
parent
c00b03de44
commit
0c20ca1ce9
1 changed files with 7 additions and 6 deletions
|
|
@ -54,21 +54,22 @@ namespace mock { namespace detail {
|
|||
struct signature<Sig(C::*)> : signature<typename strip_function_qualifiers<Sig>::type>
|
||||
{};
|
||||
|
||||
template<typename M>
|
||||
using signature_t = typename signature<std::remove_cv_t<std::remove_reference_t<M>>>::type;
|
||||
|
||||
template<typename T>
|
||||
struct base
|
||||
{
|
||||
typedef T base_type;
|
||||
};
|
||||
|
||||
// if an error is generated by the line below it means
|
||||
// the method is ambiguous : specify its signature to
|
||||
// disambiguate
|
||||
// if an error is generated by the line below it means the method is ambiguous:
|
||||
// specify its signature to disambiguate
|
||||
template<typename T>
|
||||
T& ambiguous_method_requires_to_specify_signature(const T&);
|
||||
}} // namespace mock::detail
|
||||
|
||||
#define MOCK_SIGNATURE(M) \
|
||||
mock::detail::signature<std::remove_cv_t<std::remove_reference_t<decltype( \
|
||||
mock::detail::ambiguous_method_requires_to_specify_signature(&base_type::M))>>>::type
|
||||
mock::detail::signature_t<decltype(mock::detail::ambiguous_method_requires_to_specify_signature(&base_type::M))>
|
||||
|
||||
#endif // MOCK_SIGNATURE_HPP_INCLUDED
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue