]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /* |
2 | * Copyright (c) 2012-2014 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 | ||
12 | #include <boost/type_traits/remove_cv.hpp> | |
13 | ||
14 | namespace boost { | |
15 | namespace detail { | |
16 | template<class T> | |
17 | struct array_base { | |
18 | typedef typename boost::remove_cv<T>::type type; | |
19 | }; | |
20 | ||
21 | template<class T> | |
22 | struct array_base<T[]> { | |
23 | typedef typename array_base<T>::type type; | |
24 | }; | |
25 | ||
26 | template<class T, std::size_t N> | |
27 | struct array_base<T[N]> { | |
28 | typedef typename array_base<T>::type type; | |
29 | }; | |
30 | ||
31 | template<class T> | |
32 | struct array_total { | |
33 | enum { | |
34 | size = 1 | |
35 | }; | |
36 | }; | |
37 | ||
38 | template<class T, std::size_t N> | |
39 | struct array_total<T[N]> { | |
40 | enum { | |
41 | size = N * array_total<T>::size | |
42 | }; | |
43 | }; | |
44 | ||
45 | template<class T> | |
46 | struct array_inner; | |
47 | ||
48 | template<class T> | |
49 | struct array_inner<T[]> { | |
50 | typedef T type; | |
51 | }; | |
52 | ||
53 | template<class T, std::size_t N> | |
54 | struct array_inner<T[N]> { | |
55 | typedef T type; | |
56 | }; | |
57 | } | |
58 | } | |
59 | ||
60 | #endif |