1 // Copyright (C) 2002 Ronald Garcia
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.
9 // This software is provided "as is" without express or implied warranty,
10 // and with no claim as to its suitability for any purpose.
13 #ifndef BOOST_EXTENT_RANGE_RG071801_HPP
14 #define BOOST_EXTENT_RANGE_RG071801_HPP
20 namespace multi_array {
22 template <typename Extent, typename SizeType>
23 class extent_range : private std::pair<Extent,Extent> {
24 typedef std::pair<Extent,Extent> super_type;
27 typedef SizeType size_type;
29 extent_range(index start, index finish) :
30 super_type(start,finish) { }
32 extent_range(index finish) :
33 super_type(0,finish) { }
35 extent_range() : super_type(0,0) { }
37 index start() const { return super_type::first; }
39 index finish() const { return super_type::second; }
41 size_type size() const { return super_type::second - super_type::first; }
44 } // namespace multi_array
49 #endif // BOOST_EXTENT_RANGE_RG071801_HPP