blob: 7d8ef67069092595f6cc45b154ec1f3c60c9ef51 [file] [log] [blame]
Jeff Thompsonf7d49942013-08-01 16:47:40 -07001// Copyright (C) 2004 Peder Holt
2// Use, modification and distribution is subject to the Boost Software
3// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
4
5#ifndef BOOST_TYPE_TRAITS_MSVC_REMOVE_REFERENCE_HOLT_2004_0827
6#define BOOST_TYPE_TRAITS_MSVC_REMOVE_REFERENCE_HOLT_2004_0827
7
Jeff Thompson2277ce52013-08-01 17:34:11 -07008#include <ndnboost/type_traits/msvc/typeof.hpp>
9#include <ndnboost/type_traits/is_reference.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070010
11namespace ndnboost {
12 namespace detail {
13 template<bool IsReference>
14 struct remove_reference_impl_typeof {
15 template<typename T,typename ID>
16 struct inner {
17 typedef T type;
18 };
19 };
20 template<>
21 struct remove_reference_impl_typeof<true> {
22 template<typename T,typename ID>
23 struct inner {
24 template<typename U>
25 static msvc_register_type<U,ID> test(U&(*)());
26 static msvc_register_type<T,ID> test(...);
27 BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( (T(*)())(NULL) ) ));
28 typedef typename msvc_extract_type<ID>::id2type::type type;
29 };
30 };
31 } //namespace detail
32
33 template<typename T>
34 struct remove_reference {
35 typedef typename ndnboost::detail::remove_reference_impl_typeof<
36 ndnboost::is_reference<T>::value
37 >::template inner<T,remove_reference<T> >::type type;
38 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_reference,T)
39 };
40} //namespace ndnboost
41
42#endif //BOOST_TYPE_TRAITS_MSVC_REMOVE_REFERENCE_HOLT_2004_0827