Avoid accidentally using the "check" macro on OSX

Fix for #341, #273, and #104.  Replace usages of "check(" with
"(check)(", which will prevent us from colliding with the macro defined
in OSX's Assert macros.
This commit is contained in:
Erich Keane
2016-09-07 11:55:28 -07:00
parent 1e5e648918
commit b9c424e06a
+3 -3
View File
@@ -1180,9 +1180,9 @@ namespace cereal
struct shared_from_this_wrapper
{
template <class U>
static auto check( U const & t ) -> decltype( ::cereal::access::shared_from_this(t), std::true_type() );
static auto (check)( U const & t ) -> decltype( ::cereal::access::shared_from_this(t), std::true_type() );
static auto check( ... ) -> decltype( std::false_type() );
static auto (check)( ... ) -> decltype( std::false_type() );
template <class U>
static auto get( U const & t ) -> decltype( t.shared_from_this() );
@@ -1191,7 +1191,7 @@ namespace cereal
//! Determine if T or any base class of T has inherited from std::enable_shared_from_this
template<class T>
struct has_shared_from_this : decltype(detail::shared_from_this_wrapper::check(std::declval<T>()))
struct has_shared_from_this : decltype((detail::shared_from_this_wrapper::check)(std::declval<T>()))
{ };
//! Get the type of the base class of T which inherited from std::enable_shared_from_this