Virtual Testbed
Ship dynamics simulator for extreme conditions
view.hh
1 #ifndef VTESTBED_BASE_VIEW_HH
2 #define VTESTBED_BASE_VIEW_HH
3 
4 #include <cstddef>
5 #include <iterator>
6 
7 namespace vtb {
8 
9  namespace base {
10 
11  template <class Iterator>
12  struct view {
13 
14  typedef std::size_t size_type;
15 
16  Iterator first, last;
17 
18  inline Iterator begin() const { return first; }
19  inline Iterator end() const { return last; }
20  inline size_type size() const { return std::distance(first, last); }
21  inline bool empty() const { return size() == 0; }
22 
23  };
24 
25  template <class Container>
27  make_reverse_view(const Container& rhs) {
29  rhs.crbegin(),
30  rhs.crend()
31  };
32  }
33 
34  }
35 
36 }
37 
38 
39 #endif // vim:filetype=cpp
Main namespace.
Definition: convert.hh:9