blob: 179b776b8e0b08b7d40d52984a64dfdc73c22188 [file] [log] [blame]
Jeff Thompsonf7d49942013-08-01 16:47:40 -07001/*
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 */
Jeff Thompson3d613fd2013-10-15 15:39:04 -07009#ifndef NDNBOOST_SMART_PTR_DETAIL_ARRAY_TRAITS_HPP
10#define NDNBOOST_SMART_PTR_DETAIL_ARRAY_TRAITS_HPP
Jeff Thompsonf7d49942013-08-01 16:47:40 -070011
Jeff Thompson2277ce52013-08-01 17:34:11 -070012#include <ndnboost/type_traits/remove_cv.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070013
14namespace 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