diff --git a/src/libraries/turtle/format.hpp b/src/libraries/turtle/format.hpp index e42dc6c..f91ff99 100644 --- a/src/libraries/turtle/format.hpp +++ b/src/libraries/turtle/format.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -31,29 +32,17 @@ namespace detail template< typename S > eaten operator<<( S&, const eater& ); - template< int I > - struct selector - {}; - template<> - struct selector< sizeof( std::ostream& ) > + template< typename T > + struct is_serializable_impl { - typedef boost::true_type type; - }; - template<> - struct selector< sizeof( eaten ) > - { - typedef boost::false_type type; + static std::ostream* s; + static T* t; + enum { value = sizeof( *s << *t ) == sizeof( std::ostream& ) }; }; template< typename T > - struct is_serializable - { - static std::ostream& s(); - static const T& t(); - - typedef BOOST_DEDUCED_TYPENAME - selector< sizeof( s() << t() ) >::type type; - }; + struct is_serializable : public boost::integral_constant< bool, is_serializable_impl< T >::value > + {}; template< typename T > std::string format( const T& t, diff --git a/src/libraries/turtle/is_functor.hpp b/src/libraries/turtle/is_functor.hpp index a0cf055..0b548c0 100644 --- a/src/libraries/turtle/is_functor.hpp +++ b/src/libraries/turtle/is_functor.hpp @@ -17,11 +17,11 @@ namespace mock { namespace detail { - typedef char true_type; - struct false_type - { - char padding[8]; - }; + typedef char true_type; + struct false_type + { + char padding[8]; + }; template< typename T > true_type& has_result_type_tester( T*, BOOST_DEDUCED_TYPENAME T::result_type* = 0 ); diff --git a/src/libraries/turtle/mock.hpp b/src/libraries/turtle/mock.hpp index f0949dc..2392ba3 100644 --- a/src/libraries/turtle/mock.hpp +++ b/src/libraries/turtle/mock.hpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #define BOOST_TYPEOF_SILENT #include