| 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 BOOST_MULTI_ARRAY_RANGE_LIST_HPP |
| 14 | #define BOOST_MULTI_ARRAY_RANGE_LIST_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 |
| 71 | |