BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
stdIteratorWrapper.h
Go to the documentation of this file.
1 #ifndef BALL_CONCEPT_STDITERATORWRAPPER_H
2 #define BALL_CONCEPT_STDITERATORWRAPPER_H
3 
4 #define IteratorWrapper(type)\
5  template<typename T>\
6  class type##IteratorWrapper\
7  {\
8  public:\
9  type##IteratorWrapper(T* c) : container_(c) {}\
10  type##Iterator begin() { return container_->begin##type(); }\
11  type##Iterator end() { return container_->end##type(); }\
12 \
13  private:\
14  T* container_;\
15  };
16 
17 #define ConstIteratorWrapper(type)\
18  template<typename T>\
19  class type##ConstIteratorWrapper\
20  {\
21  public:\
22  type##ConstIteratorWrapper(const T* c) : container_(c) {}\
23  type##ConstIterator begin() { return container_->begin##type(); }\
24  type##ConstIterator end() { return container_->end##type(); }\
25 \
26  private:\
27  const T* container_;\
28  };
29 
30 #define BALL_DECLARE_STD_ITERATOR_WRAPPER(container, type, method_name)\
31  type##IteratorWrapper< container > method_name () {\
32  return type##IteratorWrapper< container >(this);\
33  }\
34  type##ConstIteratorWrapper< container > method_name () const {\
35  return type##ConstIteratorWrapper< container >(this);\
36  }
37 
38 #endif //BALL_CONCEPT_STDITERATORWRAPPER_H