]> git.lyx.org Git - lyx.git/blob - boost/boost/multi_array/range_list.hpp
complie fix
[lyx.git] / boost / boost / multi_array / range_list.hpp
1 // Copyright (C) 2002 Ronald Garcia
2 //
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.
8 //
9 // This software is provided "as is" without express or implied warranty, 
10 // and with no claim as to its suitability for any purpose.
11 //
12
13 #ifndef RANGE_LIST_RG072501_HPP
14 #define RANGE_LIST_RG072501_HPP
15 //
16 // range_list.hpp - helper to build boost::arrays for *_set types
17 //
18
19 #include "boost/array.hpp"
20
21 namespace boost {
22 namespace detail {
23 namespace multi_array {
24
25 /////////////////////////////////////////////////////////////////////////
26 // choose range list begins
27 //
28
29 struct choose_range_list_n {
30   template <typename T, std::size_t NumRanges>
31   struct bind {
32     typedef boost::array<T,NumRanges> type;
33   };
34 };
35
36 struct choose_range_list_zero {
37   template <typename T, std::size_t NumRanges>
38   struct bind {
39     typedef boost::array<T,1> type;
40   };
41 };
42
43
44 template <std::size_t NumRanges>
45 struct range_list_gen_helper {
46   typedef choose_range_list_n choice;
47 };
48
49 template <>
50 struct range_list_gen_helper<0> {
51   typedef choose_range_list_zero choice;
52 };
53
54 template <typename T, std::size_t NumRanges>
55 struct range_list_generator {
56 private:
57   typedef typename range_list_gen_helper<NumRanges>::choice Choice;
58 public:
59   typedef typename Choice::template bind<T,NumRanges>::type type;
60 };
61
62 //
63 // choose range list ends
64 /////////////////////////////////////////////////////////////////////////
65
66 } // namespace multi_array
67 } // namespace detail
68 } // namespace boost
69
70 #endif // RANGE_LIST_RG072501_HPP