11 namespace archive_detail {
19 template<
typename ArcType,
typename T>
20 struct has_save_method
22 template<
typename U,
void (U::*)(ArcType&) const>
struct SFINAE {};
23 template<
typename U>
static char Test(SFINAE<U, &U::save>*);
24 template<
typename U>
static int Test(...);
25 static const bool value =
sizeof(Test<T>(0)) ==
sizeof(char);
37 template <
typename ArcType,
typename ValueType>
38 typename std::enable_if<has_save_method<ArcType, ValueType>::value,
void>::type
39 save_or_fail(ArcType& o,
const ValueType &t) {
52 template <
typename ArcType,
typename ValueType>
53 typename std::enable_if<!has_save_method<ArcType, ValueType>::value,
void>::type
54 save_or_fail(ArcType& o,
const ValueType &t) {
55 ASSERT_MSG(
false,
"Trying to serializable type %s without valid save method.",
typeid(ValueType).name());