source: NonGTP/Boost/boost/multi_array/range_list.hpp @ 857

Revision 857, 1.7 KB checked in by igarcia, 19 years ago (diff)
Line 
1// Copyright 2002 The Trustees of Indiana University.
2
3// Use, modification and distribution is subject to the Boost Software
4// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6
7//  Boost.MultiArray Library
8//  Authors: Ronald Garcia
9//           Jeremy Siek
10//           Andrew Lumsdaine
11//  See http://www.boost.org/libs/multi_array for documentation.
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
21namespace boost {
22namespace detail {
23namespace multi_array {
24
25/////////////////////////////////////////////////////////////////////////
26// choose range list begins
27//
28
29struct 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
36struct 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
44template <std::size_t NumRanges>
45struct range_list_gen_helper {
46  typedef choose_range_list_n choice;
47};
48
49template <>
50struct range_list_gen_helper<0> {
51  typedef choose_range_list_zero choice;
52};
53
54template <typename T, std::size_t NumRanges>
55struct range_list_generator {
56private:
57  typedef typename range_list_gen_helper<NumRanges>::choice Choice;
58public:
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
Note: See TracBrowser for help on using the repository browser.