Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:11

0001 /////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga  2009-2013.
0004 //
0005 // Distributed under the Boost Software License, Version 1.0.
0006 //    (See accompanying file LICENSE_1_0.txt or copy at
0007 //          http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 // See http://www.boost.org/libs/container for documentation.
0010 //
0011 /////////////////////////////////////////////////////////////////////////////
0012 //  This code was modified from the code posted by Alexandre Courpron in his
0013 //  article "Interface Detection" in The Code Project:
0014 //  http://www.codeproject.com/KB/architecture/Detector.aspx
0015 ///////////////////////////////////////////////////////////////////////////////
0016 // Copyright 2007 Alexandre Courpron
0017 //
0018 // Permission to use, copy, modify, redistribute and sell this software,
0019 // provided that this copyright notice appears on all copies of the software.
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 }  //namespace boost {
0050 }  //namespace container {
0051 }  //namespace function_detector {
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 }}} //namespace boost::container::function_detector {
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   //@ifndef BOOST_CONTAINER_DETAIL_FUNCTION_DETECTOR_HPP