Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:44:52

0001 #ifndef GENERS_IOISWRITABLE_HH_
0002 #define GENERS_IOISWRITABLE_HH_
0003 
0004 #include "Alignment/Geners/interface/IOIsClassType.hh"
0005 
0006 #include <ostream>
0007 
0008 namespace gs {
0009   template <typename T>
0010   class IOIsWritableHelper {
0011   private:
0012     template <bool (T::*)(std::ostream &) const>
0013     struct tester;
0014     typedef char One;
0015     typedef struct {
0016       char a[2];
0017     } Two;
0018     template <typename C>
0019     static One test(tester<&C::write> *);
0020     template <typename C>
0021     static Two test(...);
0022 
0023   public:
0024     enum { value = sizeof(IOIsWritableHelper<T>::template test<T>(nullptr)) == 1 };
0025   };
0026 
0027   template <typename T, bool is_class_type = IOIsClassType<T>::value>
0028   struct IOIsWritable {
0029     enum { value = 0 };
0030   };
0031 
0032   template <typename T>
0033   struct IOIsWritable<T, true> {
0034     enum { value = IOIsWritableHelper<T>::value };
0035   };
0036 }  // namespace gs
0037 
0038 #endif  // GENERS_IOISWRITABLE_HH_