annotate DEPENDENCIES/generic/include/boost/intrusive/detail/function_detector.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 /////////////////////////////////////////////////////////////////////////////
Chris@16 2 //
Chris@16 3 // (C) Copyright Ion Gaztanaga 2009-2013.
Chris@16 4 //
Chris@16 5 // Distributed under the Boost Software License, Version 1.0.
Chris@16 6 // (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 7 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 8 //
Chris@16 9 // See http://www.boost.org/libs/intrusive for documentation.
Chris@16 10 //
Chris@16 11 /////////////////////////////////////////////////////////////////////////////
Chris@16 12 // This code was modified from the code posted by Alexandre Courpron in his
Chris@16 13 // article "Interface Detection" in The Code Project:
Chris@16 14 // http://www.codeproject.com/KB/architecture/Detector.aspx
Chris@16 15 ///////////////////////////////////////////////////////////////////////////////
Chris@16 16 // Copyright 2007 Alexandre Courpron
Chris@16 17 //
Chris@16 18 // Permission to use, copy, modify, redistribute and sell this software,
Chris@16 19 // provided that this copyright notice appears on all copies of the software.
Chris@16 20 ///////////////////////////////////////////////////////////////////////////////
Chris@16 21
Chris@16 22 #ifndef BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP
Chris@16 23 #define BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP
Chris@16 24
Chris@101 25 #ifndef BOOST_CONFIG_HPP
Chris@101 26 # include <boost/config.hpp>
Chris@101 27 #endif
Chris@101 28
Chris@101 29 #if defined(BOOST_HAS_PRAGMA_ONCE)
Chris@101 30 # pragma once
Chris@101 31 #endif
Chris@16 32
Chris@16 33 namespace boost {
Chris@16 34 namespace intrusive {
Chris@16 35 namespace function_detector {
Chris@16 36
Chris@16 37 typedef char NotFoundType;
Chris@16 38 struct StaticFunctionType { NotFoundType x [2]; };
Chris@16 39 struct NonStaticFunctionType { NotFoundType x [3]; };
Chris@16 40
Chris@16 41 enum
Chris@16 42 { NotFound = 0,
Chris@16 43 StaticFunction = sizeof( StaticFunctionType ) - sizeof( NotFoundType ),
Chris@16 44 NonStaticFunction = sizeof( NonStaticFunctionType ) - sizeof( NotFoundType )
Chris@16 45 };
Chris@16 46
Chris@16 47 } //namespace boost {
Chris@16 48 } //namespace intrusive {
Chris@16 49 } //namespace function_detector {
Chris@16 50
Chris@16 51 #define BOOST_INTRUSIVE_CREATE_FUNCTION_DETECTOR(Identifier, InstantiationKey) \
Chris@16 52 namespace boost { \
Chris@16 53 namespace intrusive { \
Chris@16 54 namespace function_detector { \
Chris@16 55 template < class T, \
Chris@16 56 class NonStaticType, \
Chris@16 57 class NonStaticConstType, \
Chris@16 58 class StaticType > \
Chris@16 59 class DetectMember_##InstantiationKey_##Identifier { \
Chris@16 60 template < NonStaticType > \
Chris@16 61 struct TestNonStaticNonConst ; \
Chris@16 62 \
Chris@16 63 template < NonStaticConstType > \
Chris@16 64 struct TestNonStaticConst ; \
Chris@16 65 \
Chris@16 66 template < StaticType > \
Chris@16 67 struct TestStatic ; \
Chris@16 68 \
Chris@16 69 template <class U > \
Chris@16 70 static NonStaticFunctionType Test( TestNonStaticNonConst<&U::Identifier>*, int ); \
Chris@16 71 \
Chris@16 72 template <class U > \
Chris@16 73 static NonStaticFunctionType Test( TestNonStaticConst<&U::Identifier>*, int ); \
Chris@16 74 \
Chris@16 75 template <class U> \
Chris@16 76 static StaticFunctionType Test( TestStatic<&U::Identifier>*, int ); \
Chris@16 77 \
Chris@16 78 template <class U> \
Chris@16 79 static NotFoundType Test( ... ); \
Chris@16 80 public : \
Chris@16 81 static const int check = NotFound + (sizeof(Test<T>(0, 0)) - sizeof(NotFoundType));\
Chris@16 82 };\
Chris@16 83 }}} //namespace boost::intrusive::function_detector {
Chris@16 84
Chris@16 85 #define BOOST_INTRUSIVE_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \
Chris@16 86 ::boost::intrusive::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
Chris@16 87 ReturnType (Class::*)Params,\
Chris@16 88 ReturnType (Class::*)Params const,\
Chris@16 89 ReturnType (*)Params \
Chris@16 90 >::check
Chris@16 91
Chris@16 92 #endif //@ifndef BOOST_INTRUSIVE_DETAIL_FUNCTION_DETECTOR_HPP