summaryrefslogtreecommitdiffstats
blob: 819c5ba619d498486c6eb0cf1d49ef96dc79312e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * Copyright (c) 2012-2014 Glen Joseph Fernandes 
 * glenfe at live dot com
 *
 * Distributed under the Boost Software License, 
 * Version 1.0. (See accompanying file LICENSE_1_0.txt 
 * or copy at http://boost.org/LICENSE_1_0.txt)
 */
#ifndef BOOST_SMART_PTR_DETAIL_ARRAY_TRAITS_HPP
#define BOOST_SMART_PTR_DETAIL_ARRAY_TRAITS_HPP

#include <boost/type_traits/remove_cv.hpp>

namespace boost {
    namespace detail {
        template<class T>
        struct array_base {
            typedef typename boost::remove_cv<T>::type type;
        };

        template<class T>
        struct array_base<T[]> {
            typedef typename array_base<T>::type type;
        };

        template<class T, std::size_t N>
        struct array_base<T[N]> {
            typedef typename array_base<T>::type type;
        };

        template<class T>
        struct array_total {
            enum {
                size = 1
            };
        };

        template<class T, std::size_t N>
        struct array_total<T[N]> {
            enum {
                size = N * array_total<T>::size
            };
        };

        template<class T>
        struct array_inner;

        template<class T>
        struct array_inner<T[]> {
            typedef T type;
        };

        template<class T, std::size_t N>
        struct array_inner<T[N]> {
            typedef T type;
        };
    }
}

#endif