1 // Copyright (C) 2002 Ronald Garcia
3 // Permission to copy, use, sell and distribute this software is granted
4 // provided this copyright notice appears in all copies.
5 // Permission to modify the code and to distribute modified code is granted
6 // provided this copyright notice appears in all copies, and a notice
7 // that the code was modified is included with the copyright notice.
9 // This software is provided "as is" without express or implied warranty,
10 // and with no claim as to its suitability for any purpose.
13 #ifndef RANGE_LIST_RG072501_HPP
14 #define RANGE_LIST_RG072501_HPP
16 // range_list.hpp - helper to build boost::arrays for *_set types
19 #include "boost/array.hpp"
23 namespace multi_array {
25 /////////////////////////////////////////////////////////////////////////
26 // choose range list begins
29 struct choose_range_list_n {
30 template <typename T, std::size_t NumRanges>
32 typedef boost::array<T,NumRanges> type;
36 struct choose_range_list_zero {
37 template <typename T, std::size_t NumRanges>
39 typedef boost::array<T,1> type;
44 template <std::size_t NumRanges>
45 struct range_list_gen_helper {
46 typedef choose_range_list_n choice;
50 struct range_list_gen_helper<0> {
51 typedef choose_range_list_zero choice;
54 template <typename T, std::size_t NumRanges>
55 struct range_list_generator {
57 typedef typename range_list_gen_helper<NumRanges>::choice Choice;
59 typedef typename Choice::template bind<T,NumRanges>::type type;
63 // choose range list ends
64 /////////////////////////////////////////////////////////////////////////
66 } // namespace multi_array
70 #endif // RANGE_LIST_RG072501_HPP