]> git.lyx.org Git - lyx.git/blob - boost/boost/multi_array/extent_range.hpp
update boost
[lyx.git] / boost / boost / multi_array / extent_range.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 BOOST_EXTENT_RANGE_RG071801_HPP
14 #define BOOST_EXTENT_RANGE_RG071801_HPP
15
16 #include <utility>
17
18 namespace boost {
19 namespace detail {
20 namespace multi_array {
21
22 template <typename Extent, typename SizeType>
23 class extent_range : private std::pair<Extent,Extent> {
24   typedef std::pair<Extent,Extent> super_type;
25 public:
26   typedef Extent index;
27   typedef SizeType size_type;
28
29   extent_range(index start, index finish) :
30     super_type(start,finish) { }
31
32   extent_range(index finish) :
33     super_type(0,finish) { }
34
35   extent_range() : super_type(0,0) { }
36
37   index start() const { return super_type::first; }
38
39   index finish() const { return super_type::second; }
40
41   size_type size() const { return super_type::second - super_type::first; }
42 };
43
44 } // namespace multi_array
45 } // namespace detail 
46 } // namespace boost
47
48
49 #endif // BOOST_EXTENT_RANGE_RG071801_HPP