Flow123d  release_3.0.0-1212-g8801db3
range_wrapper.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file range_wrapper.hh
15  * @brief Implementation of range helper class.
16  */
17 
18 #ifndef RANGE_WRAPPER_HH_
19 #define RANGE_WRAPPER_HH_
20 
22 
23 /**
24  * @brief Range helper class.
25  *
26  * Allow iterate in bounds given by begin and end iterator. Class can be used for iterable accessor classes.
27  *
28  * Template argument:
29  * - ObjectIn Type over its instances is iterated,
30  * - ObjectOut Operators '*' and '->' returns objects of this type.
31  *
32  * Require the template object to implement:
33  * - ObjectIn must be implicitly convertible to ObjectOut type.
34  */
35 template<class ObjectIn, class ObjectOut>
37 {
38 public:
39  /// Constructor.
41  : begin_(begin), end_(end) {}
42 
43  /// Iterator to begin item of range.
45  return begin_;
46  }
47 
48  /// Iterator to end item of range.
50  return end_;
51  }
52 
53 private:
56 };
57 
58 
59 /**
60  * @brief Range helper class.
61  *
62  * Same as previous but doesn't provide specialization of operators '*' and '->'.
63  */
64 template<class Object>
66 
67 
68 #endif // RANGE_WRAPPER_HH_
IterConvert< ObjectIn, ObjectOut > end_
Template Iter serves as general template for internal iterators.
IterConvert< ObjectIn, ObjectOut > begin()
Iterator to begin item of range.
Range helper class.
IterConvert< ObjectIn, ObjectOut > begin_
IterConvert< ObjectIn, ObjectOut > end()
Iterator to end item of range.
RangeConvert(IterConvert< ObjectIn, ObjectOut > begin, IterConvert< ObjectIn, ObjectOut > end)
Constructor.
General iterator template. Provides iterator over objects of type ObjectIn in some container...