git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@16 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2009-08-31 09:24:23 +00:00
parent 7781ba4e58
commit 8015fb8a9f
3 changed files with 14 additions and 25 deletions

View file

@ -12,6 +12,7 @@
#include <boost/type_traits.hpp> #include <boost/type_traits.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <sstream> #include <sstream>
#include <ostream> #include <ostream>
@ -31,29 +32,17 @@ namespace detail
template< typename S > template< typename S >
eaten operator<<( S&, const eater& ); eaten operator<<( S&, const eater& );
template< int I > template< typename T >
struct selector struct is_serializable_impl
{};
template<>
struct selector< sizeof( std::ostream& ) >
{ {
typedef boost::true_type type; static std::ostream* s;
}; static T* t;
template<> enum { value = sizeof( *s << *t ) == sizeof( std::ostream& ) };
struct selector< sizeof( eaten ) >
{
typedef boost::false_type type;
}; };
template< typename T > template< typename T >
struct is_serializable struct is_serializable : public boost::integral_constant< bool, is_serializable_impl< T >::value >
{ {};
static std::ostream& s();
static const T& t();
typedef BOOST_DEDUCED_TYPENAME
selector< sizeof( s() << t() ) >::type type;
};
template< typename T > template< typename T >
std::string format( const T& t, std::string format( const T& t,

View file

@ -24,7 +24,7 @@
#include <boost/function_types/function_type.hpp> #include <boost/function_types/function_type.hpp>
#include <boost/mpl/vector.hpp> #include <boost/mpl/vector.hpp>
#include <boost/mpl/erase.hpp> #include <boost/mpl/erase.hpp>
#include <boost/mpl/insert_range.hpp> #include <boost/mpl/copy.hpp>
#include <boost/mpl/back_inserter.hpp> #include <boost/mpl/back_inserter.hpp>
#define BOOST_TYPEOF_SILENT #define BOOST_TYPEOF_SILENT
#include <boost/typeof/typeof.hpp> #include <boost/typeof/typeof.hpp>