is_loading.hpp
Go to the documentation of this file.
1 
16 #ifndef MLPACK_CORE_CEREAL_IS_LOADING_HPP
17 #define MLPACK_CORE_CEREAL_IS_LOADING_HPP
18 
19 #include <cereal/archives/binary.hpp>
20 #include <cereal/archives/portable_binary.hpp>
21 #include <cereal/archives/xml.hpp>
22 #include <cereal/archives/json.hpp>
23 
24 namespace cereal {
25 
26 template<typename Archive>
28 {
29  // Archive::is_loading is not implemented yet, so we can use std::is_same<>
30  // to check if it is a loading archive.
31  constexpr static bool value = std::is_same<Archive,
32  cereal::BinaryInputArchive>::value ||
33 // #if (BINDING_TYPE != BINDING_TYPE_R)
34  std::is_same<Archive, cereal::JSONInputArchive>::value ||
35 // #endif
36  std::is_same<Archive, cereal::XMLInputArchive>::value;
37 };
38 
39 template<typename Archive>
41  const typename std::enable_if<
42  is_cereal_archive<Archive>::value, Archive>::type* = 0)
43 {
44  return true;
45 }
46 
47 template<typename Archive>
49  const typename std::enable_if<
50  !is_cereal_archive<Archive>::value, Archive>::type* = 0)
51 {
52  return false;
53 }
54 
55 } // namespace cereal
56 
57 #endif // CEREAL_IS_LOADING_HPP
bool is_loading(const typename std::enable_if< is_cereal_archive< Archive >::value, Archive >::type *=0)
Definition: is_loading.hpp:40
static constexpr bool value
Definition: is_loading.hpp:31