Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-11 23:27:31

0001 #ifndef GENERS_IOISPOD_HH_
0002 #define GENERS_IOISPOD_HH_
0003 
0004 #include "Alignment/Geners/interface/CPP11_type_traits.hh"
0005 
0006 namespace gs {
0007   // In the following template, enum "IsPOD" is evaluated to 1
0008   // at compile time if T belongs to one of the known POD types.
0009   template <typename T>
0010   struct IOIsPOD {
0011     enum { value = std::is_standard_layout<T>::value && std::is_trivial<T>::value };
0012   };
0013 }  // namespace gs
0014 
0015 // Use the following macro (outside of any namespace)
0016 // to declare some struct as POD for I/O purposes
0017 //
0018 #define gs_declare_type_as_pod(T) /**/ \
0019   namespace gs {                       \
0020     template <>                        \
0021     struct IOIsPOD<T> {                \
0022       enum { value = 1 };              \
0023     };                                 \
0024     template <>                        \
0025     struct IOIsPOD<T const> {          \
0026       enum { value = 1 };              \
0027     };                                 \
0028     template <>                        \
0029     struct IOIsPOD<T volatile> {       \
0030       enum { value = 1 };              \
0031     };                                 \
0032     template <>                        \
0033     struct IOIsPOD<T const volatile> { \
0034       enum { value = 1 };              \
0035     };                                 \
0036   }
0037 
0038 #endif  // GENERS_IOISPOD_HH_