1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#ifndef GENERS_IOISWRITABLE_HH_
#define GENERS_IOISWRITABLE_HH_
#include "Alignment/Geners/interface/IOIsClassType.hh"
#include <ostream>
namespace gs {
template <typename T>
class IOIsWritableHelper {
private:
template <bool (T::*)(std::ostream &) const>
struct tester;
typedef char One;
typedef struct {
char a[2];
} Two;
template <typename C>
static One test(tester<&C::write> *);
template <typename C>
static Two test(...);
public:
enum { value = sizeof(IOIsWritableHelper<T>::template test<T>(nullptr)) == 1 };
};
template <typename T, bool is_class_type = IOIsClassType<T>::value>
struct IOIsWritable {
enum { value = 0 };
};
template <typename T>
struct IOIsWritable<T, true> {
enum { value = IOIsWritableHelper<T>::value };
};
} // namespace gs
#endif // GENERS_IOISWRITABLE_HH_
|