CARLA
Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Util/ListView.h
Go to the documentation of this file.
1 // Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #pragma once
8 
9 template<typename IT>
10 class ListView
11 {
12 public:
13 
14  using iterator = IT;
15 
16  explicit ListView(iterator begin, iterator end) : Begin(begin), End(end) {}
17 
18  template <typename STL_CONTAINER>
19  explicit ListView(STL_CONTAINER &StlContainer) :
20  Begin(iterator(StlContainer.begin())),
21  End(iterator(StlContainer.end())) {}
22 
23  ListView(const ListView &) = default;
24  ListView &operator=(const ListView &) = delete;
25 
26  iterator begin() const {
27  return Begin;
28  }
29 
30  iterator end() const {
31  return End;
32  }
33 
34  bool empty() const {
35  return Begin == End;
36  }
37 
38 private:
39 
40  const iterator Begin;
41 
42  const iterator End;
43 };
ListView & operator=(const ListView &)=delete