File indexing completed on 2025-12-15 09:53:44
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #ifndef BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP
0023 #define BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP
0024
0025 #ifndef BOOST_CONFIG_HPP
0026 # include <boost/config.hpp>
0027 #endif
0028
0029 #if defined(BOOST_HAS_PRAGMA_ONCE)
0030 # pragma once
0031 #endif
0032
0033 namespace boost {
0034 namespace intrusive {
0035 namespace function_detector {
0036
0037 typedef char NotFoundType;
0038 struct StaticFunctionType { NotFoundType x [2]; };
0039 struct NonStaticFunctionType { NotFoundType x [3]; };
0040
0041 enum
0042 { NotFound = 0,
0043 StaticFunction = sizeof( StaticFunctionType ) - sizeof( NotFoundType ),
0044 NonStaticFunction = sizeof( NonStaticFunctionType ) - sizeof( NotFoundType )
0045 };
0046
0047 }
0048 }
0049 }
0050
0051 #define BOOST_INTRUSIVE_CREATE_FUNCTION_DETECTOR(Identifier, InstantiationKey) \
0052 namespace boost { \
0053 namespace intrusive { \
0054 namespace function_detector { \
0055 template < class T, \
0056 class NonStaticType, \
0057 class NonStaticConstType, \
0058 class StaticType > \
0059 class DetectMember_##InstantiationKey_##Identifier { \
0060 template < NonStaticType > \
0061 struct TestNonStaticNonConst ; \
0062 \
0063 template < NonStaticConstType > \
0064 struct TestNonStaticConst ; \
0065 \
0066 template < StaticType > \
0067 struct TestStatic ; \
0068 \
0069 template <class U > \
0070 static NonStaticFunctionType Test( TestNonStaticNonConst<&U::Identifier>*, int ); \
0071 \
0072 template <class U > \
0073 static NonStaticFunctionType Test( TestNonStaticConst<&U::Identifier>*, int ); \
0074 \
0075 template <class U> \
0076 static StaticFunctionType Test( TestStatic<&U::Identifier>*, int ); \
0077 \
0078 template <class U> \
0079 static NotFoundType Test( ... ); \
0080 public : \
0081 static const int check = NotFound + int(sizeof(Test<T>(0, 0)) - sizeof(NotFoundType));\
0082 };\
0083 }}}
0084
0085 #define BOOST_INTRUSIVE_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \
0086 ::boost::intrusive::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
0087 ReturnType (Class::*)Params,\
0088 ReturnType (Class::*)Params const,\
0089 ReturnType (*)Params \
0090 >::check
0091
0092 #endif