blob: cc9e8b86221f10cfa027fdbb5dab9b266adf936b [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -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_ALL_EXTENT_HOLT_2004_0827
6#define BOOST_TYPE_TRAITS_MSVC_REMOVE_ALL_EXTENT_HOLT_2004_0827
7
8#include <ndnboost/type_traits/msvc/typeof.hpp>
9#include <ndnboost/type_traits/is_array.hpp>
10
11namespace ndnboost {
12 template<typename T>
13 struct remove_all_extents;
14
15 namespace detail {
16 template<bool IsArray>
17 struct remove_all_extents_impl_typeof {
18 template<typename T,typename ID>
19 struct inner {
20 typedef T type;
21 };
22 };
23 template<>
24 struct remove_all_extents_impl_typeof<true> {
25 template<typename T,typename ID>
26 struct inner {
27 template<typename U>
28 static msvc_register_type<U,ID> test(U[]);
29 static msvc_register_type<T,ID> test(...);
30 BOOST_STATIC_CONSTANT(unsigned,register_test=sizeof(test( *((T*)NULL) ) ));
31 typedef typename msvc_extract_type<ID>::id2type::type reduced_type;
32 typedef typename remove_all_extents<reduced_type>::type type;
33 };
34 };
35 } //namespace detail
36
37 template<typename T>
38 struct remove_all_extents {
39 typedef typename ndnboost::detail::remove_all_extents_impl_typeof<
40 ndnboost::is_array<T>::value
41 >::template inner<T,remove_all_extents<T> >::type type;
42 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,remove_all_extents,T)
43 };
44} //namespace ndnboost
45
46#endif //BOOST_TYPE_TRAITS_MSVC_REMOVE_BOUNDS_HOLT_2004_0827
47