Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 1 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 2 | #ifndef NDNBOOST_MPL_AUX_HAS_REBIND_HPP_INCLUDED |
| 3 | #define NDNBOOST_MPL_AUX_HAS_REBIND_HPP_INCLUDED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 4 | |
| 5 | // Copyright Aleksey Gurtovoy 2002-2004 |
| 6 | // |
| 7 | // Distributed under the Boost Software License, Version 1.0. |
| 8 | // (See accompanying file LICENSE_1_0.txt or copy at |
| 9 | // http://www.boost.org/LICENSE_1_0.txt) |
| 10 | // |
| 11 | // See http://www.boost.org/libs/mpl for documentation. |
| 12 | |
| 13 | // $Id: has_rebind.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ |
| 14 | // $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ |
| 15 | // $Revision: 49267 $ |
| 16 | |
| 17 | #include <ndnboost/mpl/aux_/config/msvc.hpp> |
| 18 | #include <ndnboost/mpl/aux_/config/intel.hpp> |
| 19 | #include <ndnboost/mpl/aux_/config/workaround.hpp> |
| 20 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 21 | #if NDNBOOST_WORKAROUND(__EDG_VERSION__, <= 244) && !defined(NDNBOOST_INTEL_CXX_VERSION) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 22 | # include <ndnboost/mpl/has_xxx.hpp> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 23 | #elif NDNBOOST_WORKAROUND(NDNBOOST_MSVC, < 1300) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 24 | # include <ndnboost/mpl/has_xxx.hpp> |
| 25 | # include <ndnboost/mpl/if.hpp> |
| 26 | # include <ndnboost/mpl/bool.hpp> |
| 27 | # include <ndnboost/mpl/aux_/msvc_is_class.hpp> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 28 | #elif NDNBOOST_WORKAROUND(__BORLANDC__, NDNBOOST_TESTED_AT(0x610)) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 29 | # include <ndnboost/mpl/if.hpp> |
| 30 | # include <ndnboost/mpl/bool.hpp> |
| 31 | # include <ndnboost/mpl/aux_/yes_no.hpp> |
| 32 | # include <ndnboost/mpl/aux_/config/static_constant.hpp> |
| 33 | # include <ndnboost/type_traits/is_class.hpp> |
| 34 | #else |
| 35 | # include <ndnboost/mpl/aux_/type_wrapper.hpp> |
| 36 | # include <ndnboost/mpl/aux_/yes_no.hpp> |
| 37 | # include <ndnboost/mpl/aux_/config/static_constant.hpp> |
| 38 | #endif |
| 39 | |
| 40 | namespace ndnboost { namespace mpl { namespace aux { |
| 41 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 42 | #if NDNBOOST_WORKAROUND(__EDG_VERSION__, <= 244) && !defined(NDNBOOST_INTEL_CXX_VERSION) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 43 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 44 | NDNBOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_rebind, rebind, false) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 45 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 46 | #elif NDNBOOST_WORKAROUND(NDNBOOST_MSVC, < 1300) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 47 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 48 | NDNBOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_rebind_impl, rebind, false) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 49 | |
| 50 | template< typename T > |
| 51 | struct has_rebind |
| 52 | : if_< |
| 53 | msvc_is_class<T> |
| 54 | , has_rebind_impl<T> |
| 55 | , bool_<false> |
| 56 | >::type |
| 57 | { |
| 58 | }; |
| 59 | |
| 60 | #else // the rest |
| 61 | |
| 62 | template< typename T > struct has_rebind_tag {}; |
| 63 | no_tag operator|(has_rebind_tag<int>, void const volatile*); |
| 64 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 65 | # if !NDNBOOST_WORKAROUND(__BORLANDC__, NDNBOOST_TESTED_AT(0x610)) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 66 | template< typename T > |
| 67 | struct has_rebind |
| 68 | { |
| 69 | static has_rebind_tag<T>* get(); |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 70 | NDNBOOST_STATIC_CONSTANT(bool, value = |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 71 | sizeof(has_rebind_tag<int>() | get()) == sizeof(yes_tag) |
| 72 | ); |
| 73 | }; |
| 74 | # else // __BORLANDC__ |
| 75 | template< typename T > |
| 76 | struct has_rebind_impl |
| 77 | { |
| 78 | static T* get(); |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 79 | NDNBOOST_STATIC_CONSTANT(bool, value = |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 80 | sizeof(has_rebind_tag<int>() | get()) == sizeof(yes_tag) |
| 81 | ); |
| 82 | }; |
| 83 | |
| 84 | template< typename T > |
| 85 | struct has_rebind |
| 86 | : if_< |
| 87 | is_class<T> |
| 88 | , has_rebind_impl<T> |
| 89 | , bool_<false> |
| 90 | >::type |
| 91 | { |
| 92 | }; |
| 93 | # endif // __BORLANDC__ |
| 94 | |
| 95 | #endif |
| 96 | |
| 97 | }}} |
| 98 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame^] | 99 | #endif // NDNBOOST_MPL_AUX_HAS_REBIND_HPP_INCLUDED |