Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 Glen Joseph Fernandes |
| 3 | * glenfe at live dot com |
| 4 | * |
| 5 | * Distributed under the Boost Software License, |
| 6 | * Version 1.0. (See accompanying file LICENSE_1_0.txt |
| 7 | * or copy at http://boost.org/LICENSE_1_0.txt) |
| 8 | */ |
| 9 | #ifndef BOOST_SMART_PTR_DETAIL_ARRAY_TRAITS_HPP |
| 10 | #define BOOST_SMART_PTR_DETAIL_ARRAY_TRAITS_HPP |
| 11 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame^] | 12 | #include <ndnboost/type_traits/remove_cv.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 13 | |
| 14 | namespace ndnboost { |
| 15 | namespace detail { |
| 16 | template<typename T> |
| 17 | struct array_base { |
| 18 | typedef typename ndnboost::remove_cv<T>::type type; |
| 19 | }; |
| 20 | template<typename T> |
| 21 | struct array_base<T[]> { |
| 22 | typedef typename array_base<T>::type type; |
| 23 | }; |
| 24 | template<typename T, std::size_t N> |
| 25 | struct array_base<T[N]> { |
| 26 | typedef typename array_base<T>::type type; |
| 27 | }; |
| 28 | template<typename T> |
| 29 | struct array_total { |
| 30 | enum { |
| 31 | size = 1 |
| 32 | }; |
| 33 | }; |
| 34 | template<typename T, std::size_t N> |
| 35 | struct array_total<T[N]> { |
| 36 | enum { |
| 37 | size = N * array_total<T>::size |
| 38 | }; |
| 39 | }; |
| 40 | template<typename T> |
| 41 | struct array_inner; |
| 42 | template<typename T> |
| 43 | struct array_inner<T[]> { |
| 44 | typedef T type; |
| 45 | }; |
| 46 | template<typename T, std::size_t N> |
| 47 | struct array_inner<T[N]> { |
| 48 | typedef T type; |
| 49 | }; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | #endif |