File indexing completed on 2025-01-18 09:30:11
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #ifndef BOOST_CONTAINER_DETAIL_FUNCTION_DETECTOR_HPP
0023 #define BOOST_CONTAINER_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 #include <boost/container/detail/config_begin.hpp>
0034
0035 namespace boost {
0036 namespace container {
0037 namespace function_detector {
0038
0039 typedef char NotFoundType;
0040 struct StaticFunctionType { NotFoundType x [2]; };
0041 struct NonStaticFunctionType { NotFoundType x [3]; };
0042
0043 enum
0044 { NotFound = 0,
0045 StaticFunction = sizeof( StaticFunctionType ) - sizeof( NotFoundType ),
0046 NonStaticFunction = sizeof( NonStaticFunctionType ) - sizeof( NotFoundType )
0047 };
0048
0049 }
0050 }
0051 }
0052
0053 #define BOOST_CONTAINER_CREATE_FUNCTION_DETECTOR(Identifier, InstantiationKey) \
0054 namespace boost { \
0055 namespace container { \
0056 namespace function_detector { \
0057 template < class T, \
0058 class NonStaticType, \
0059 class NonStaticConstType, \
0060 class StaticType > \
0061 class DetectMember_##InstantiationKey_##Identifier { \
0062 template < NonStaticType > \
0063 struct TestNonStaticNonConst ; \
0064 \
0065 template < NonStaticConstType > \
0066 struct TestNonStaticConst ; \
0067 \
0068 template < StaticType > \
0069 struct TestStatic ; \
0070 \
0071 template <class U > \
0072 static NonStaticFunctionType Test( TestNonStaticNonConst<&U::Identifier>*, int ); \
0073 \
0074 template <class U > \
0075 static NonStaticFunctionType Test( TestNonStaticConst<&U::Identifier>*, int ); \
0076 \
0077 template <class U> \
0078 static StaticFunctionType Test( TestStatic<&U::Identifier>*, int ); \
0079 \
0080 template <class U> \
0081 static NotFoundType Test( ... ); \
0082 public : \
0083 static const int check = NotFound + (sizeof(Test<T>(0, 0)) - sizeof(NotFoundType));\
0084 };\
0085 }}}
0086
0087 #define BOOST_CONTAINER_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \
0088 ::boost::container::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
0089 ReturnType (Class::*)Params,\
0090 ReturnType (Class::*)Params const,\
0091 ReturnType (*)Params \
0092 >::check
0093
0094 #include <boost/container/detail/config_end.hpp>
0095
0096 #endif