epoc32/include/stdapis/boost/multi_array/extent_gen.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/multi_array/extent_gen.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,75 @@
     1.4 +// Copyright 2002 The Trustees of Indiana University.
     1.5 +
     1.6 +// Use, modification and distribution is subject to the Boost Software 
     1.7 +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     1.8 +// http://www.boost.org/LICENSE_1_0.txt)
     1.9 +
    1.10 +//  Boost.MultiArray Library
    1.11 +//  Authors: Ronald Garcia
    1.12 +//           Jeremy Siek
    1.13 +//           Andrew Lumsdaine
    1.14 +//  See http://www.boost.org/libs/multi_array for documentation.
    1.15 +
    1.16 +#ifndef BOOST_EXTENT_GEN_RG071801_HPP
    1.17 +#define BOOST_EXTENT_GEN_RG071801_HPP
    1.18 +
    1.19 +#include "boost/multi_array/extent_range.hpp"
    1.20 +#include "boost/multi_array/range_list.hpp"
    1.21 +#include "boost/multi_array/types.hpp"
    1.22 +#include "boost/array.hpp"
    1.23 +#include <algorithm>
    1.24 +
    1.25 +namespace boost {
    1.26 +namespace detail {
    1.27 +namespace multi_array {
    1.28 +
    1.29 +
    1.30 +template <std::size_t NumRanges>
    1.31 +class extent_gen {
    1.32 +public:
    1.33 +  typedef boost::detail::multi_array::index index;
    1.34 +  typedef boost::detail::multi_array::size_type size_type;
    1.35 +  typedef extent_range<index,size_type> range;
    1.36 +private:
    1.37 +  typedef typename range_list_generator<range,NumRanges>::type range_list;
    1.38 +public:
    1.39 +  template <std::size_t Ranges>
    1.40 +  struct gen_type {
    1.41 +    typedef extent_gen<Ranges> type;
    1.42 +  };
    1.43 +
    1.44 +  range_list ranges_;
    1.45 +
    1.46 +  extent_gen() { }
    1.47 +
    1.48 +  // Used by operator[] to expand extent_gens
    1.49 +  extent_gen(const extent_gen<NumRanges-1>& rhs,
    1.50 +            const range& a_range)
    1.51 +  {
    1.52 +    std::copy(rhs.ranges_.begin(),rhs.ranges_.end(),ranges_.begin());
    1.53 +    *ranges_.rbegin() = a_range;
    1.54 +  }
    1.55 +
    1.56 +  extent_gen<NumRanges+1>
    1.57 +  operator[](const range& a_range)
    1.58 +  {
    1.59 +    return extent_gen<NumRanges+1>(*this,a_range);    
    1.60 +  }
    1.61 +
    1.62 +  extent_gen<NumRanges+1>
    1.63 +  operator[](index idx)
    1.64 +  {
    1.65 +    return extent_gen<NumRanges+1>(*this,range(0,idx));    
    1.66 +  }    
    1.67 +
    1.68 +  static extent_gen<0> extents() {
    1.69 +    return extent_gen<0>();
    1.70 +  }
    1.71 +};
    1.72 +
    1.73 +} // namespace multi_array
    1.74 +} // namespace detail
    1.75 +} // namespace boost
    1.76 +
    1.77 +
    1.78 +#endif // BOOST_EXTENT_GEN_RG071801_HPP