Chris@16
|
1 // Copyright 2002 The Trustees of Indiana University.
|
Chris@16
|
2
|
Chris@16
|
3 // Use, modification and distribution is subject to the Boost Software
|
Chris@16
|
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
5 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6
|
Chris@16
|
7 // Boost.MultiArray Library
|
Chris@16
|
8 // Authors: Ronald Garcia
|
Chris@16
|
9 // Jeremy Siek
|
Chris@16
|
10 // Andrew Lumsdaine
|
Chris@16
|
11 // See http://www.boost.org/libs/multi_array for documentation.
|
Chris@16
|
12
|
Chris@16
|
13 #ifndef RANGE_LIST_RG072501_HPP
|
Chris@16
|
14 #define RANGE_LIST_RG072501_HPP
|
Chris@16
|
15 //
|
Chris@16
|
16 // range_list.hpp - helper to build boost::arrays for *_set types
|
Chris@16
|
17 //
|
Chris@16
|
18
|
Chris@16
|
19 #include "boost/array.hpp"
|
Chris@16
|
20
|
Chris@16
|
21 namespace boost {
|
Chris@16
|
22 namespace detail {
|
Chris@16
|
23 namespace multi_array {
|
Chris@16
|
24
|
Chris@16
|
25 /////////////////////////////////////////////////////////////////////////
|
Chris@16
|
26 // choose range list begins
|
Chris@16
|
27 //
|
Chris@16
|
28
|
Chris@16
|
29 struct choose_range_list_n {
|
Chris@16
|
30 template <typename T, std::size_t NumRanges>
|
Chris@16
|
31 struct bind {
|
Chris@16
|
32 typedef boost::array<T,NumRanges> type;
|
Chris@16
|
33 };
|
Chris@16
|
34 };
|
Chris@16
|
35
|
Chris@16
|
36 struct choose_range_list_zero {
|
Chris@16
|
37 template <typename T, std::size_t NumRanges>
|
Chris@16
|
38 struct bind {
|
Chris@16
|
39 typedef boost::array<T,1> type;
|
Chris@16
|
40 };
|
Chris@16
|
41 };
|
Chris@16
|
42
|
Chris@16
|
43
|
Chris@16
|
44 template <std::size_t NumRanges>
|
Chris@16
|
45 struct range_list_gen_helper {
|
Chris@16
|
46 typedef choose_range_list_n choice;
|
Chris@16
|
47 };
|
Chris@16
|
48
|
Chris@16
|
49 template <>
|
Chris@16
|
50 struct range_list_gen_helper<0> {
|
Chris@16
|
51 typedef choose_range_list_zero choice;
|
Chris@16
|
52 };
|
Chris@16
|
53
|
Chris@16
|
54 template <typename T, std::size_t NumRanges>
|
Chris@16
|
55 struct range_list_generator {
|
Chris@16
|
56 private:
|
Chris@16
|
57 typedef typename range_list_gen_helper<NumRanges>::choice Choice;
|
Chris@16
|
58 public:
|
Chris@16
|
59 typedef typename Choice::template bind<T,NumRanges>::type type;
|
Chris@16
|
60 };
|
Chris@16
|
61
|
Chris@16
|
62 //
|
Chris@16
|
63 // choose range list ends
|
Chris@16
|
64 /////////////////////////////////////////////////////////////////////////
|
Chris@16
|
65
|
Chris@16
|
66 } // namespace multi_array
|
Chris@16
|
67 } // namespace detail
|
Chris@16
|
68 } // namespace boost
|
Chris@16
|
69
|
Chris@16
|
70 #endif // RANGE_LIST_RG072501_HPP
|