HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_IteratorRange.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_IteratorRange.h ( UT Library, C++)
7  *
8  * COMMENTS: A simple helper class to wrap an iterator range
9  * into a single object, suitable for use with range-based
10  * for loops.
11  */
12 
13 #ifndef __UT_IteratorRange__
14 #define __UT_IteratorRange__
15 
16 #include <utility>
17 
18 template<typename IterT>
20 {
21 public:
22  UT_IteratorRange(IterT &&begin_it, IterT &&end_it) :
23  myBegin(std::move(begin_it)), myEnd(std::move(end_it))
24  {}
25 
26  IterT begin() const { return myBegin; }
27  IterT end() const { return myEnd; }
28 
29  bool isEmpty() const { return myBegin == myEnd; }
30 private:
31  IterT myBegin, myEnd;
32 };
33 
34 template<typename IterT>
36 {
38  std::forward<IterT>(b), std::forward<IterT>(e));
39 }
40 
41 #endif // __UT_IteratorRange__
UT_IteratorRange< IterT > UTmakeRange(IterT &&b, IterT &&e)
IterT begin() const
IterT end() const
UT_IteratorRange(IterT &&begin_it, IterT &&end_it)
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
bool isEmpty() const