Classdesc
3.44
use_mbr_pointers.h
1
/*
2
@copyright Russell Standish 2018
3
@author Russell Standish
4
This file is part of Classdesc
5
6
Open source licensed under the MIT license. See LICENSE for details.
7
*/
11
#ifndef CLASSDESC_USE_MBR_POINTERS_H
12
#define CLASSDESC_USE_MBR_POINTERS_H
13
#include "
function.h
"
14
15
#define CLASSDESC_USE_OLDSTYLE_MEMBER_OBJECTS(descriptor) \
16
using classdesc::descriptor; \
17
namespace classdesc { \
18
template<class C, class T> \
19
typename enable_if<And<is_member_object_pointer<T>, \
20
Not<functional::is_nonmember_function_ptr<T> > >,void>::T \
21
descriptor(descriptor##_t& b, const string& d, C& o, T y) \
22
{::descriptor(b,d,o.*y);} \
23
\
24
/* for static object members */
\
25
template<class C, class T> \
26
typename enable_if< \
27
And<Not<is_base_of<is_const_static,C> >, \
28
is_object<T> >,void>::T \
29
descriptor(descriptor##_t& b, const string& d, C&, T* y) \
30
{::descriptor(b,d,*y);} \
31
}
32
33
// do nothing for function objects - suitable for all serialisation descriptors
34
#define CLASSDESC_FUNCTION_NOP(descriptor) \
35
namespace classdesc { \
36
/* bare function support */
\
37
template<class T> \
38
typename enable_if<is_function<T>,void>::T \
39
descriptor(descriptor##_t& b, const string& d, T* y) \
40
{} \
41
\
42
/* -use_mbr_pointers support for member functions */
\
43
template<class C, class T> \
44
typename enable_if<is_member_function_pointer<T>,void>::T \
45
descriptor(descriptor##_t&, const string&, C&, T) {} \
46
\
47
/* -use_mbr_pointers support for function pointer members */
\
48
template<class C, class T> \
49
typename enable_if<functional::is_nonmember_function_ptr<T>,void>::T \
50
descriptor(descriptor##_t&, const string&, C, T) \
51
{} \
52
}
53
54
#endif
function.h
Metaprogramming support for processing functions of multiple arguments.
use_mbr_pointers.h
Generated by
1.14.0