31 namespace archive_detail {
39 template<
typename ArcType,
typename T>
40 struct has_save_method
42 template<
typename U,
void (U::*)(ArcType&) const>
struct SFINAE {};
43 template<
typename U>
static char Test(SFINAE<U, &U::save>*);
44 template<
typename U>
static int Test(...);
45 static const bool value =
sizeof(Test<T>(0)) ==
sizeof(char);
57 template <
typename ArcType,
typename ValueType>
58 typename boost::enable_if_c<has_save_method<ArcType, ValueType>::value,
void>::type
59 save_or_fail(ArcType& o,
const ValueType &t) {
72 template <
typename ArcType,
typename ValueType>
73 typename boost::disable_if_c<has_save_method<ArcType, ValueType>::value,
void>::type
74 save_or_fail(ArcType& o,
const ValueType &t) {
75 ASSERT_MSG(
false,
"Trying to serializable type %s without valid save method.",
typeid(ValueType).name());