Non-owning view over a map of owning pointers, exposing (id, raw pointer) pairs.
More...
#include <PtrMapView.hpp>
|
| class | iterator |
| | Forward iterator returning (id, pointer) pairs by value. More...
|
|
|
using | map_type = std::unordered_map<Id, std::unique_ptr<std::remove_const_t<T>>> |
|
|
| PtrMapView (map_type const &map) noexcept |
|
iterator | begin () const noexcept |
|
iterator | end () const noexcept |
|
iterator | cbegin () const noexcept |
|
iterator | cend () const noexcept |
|
auto | size () const noexcept |
| | Get the number of elements.
|
|
bool | empty () const noexcept |
| | Check if the view is empty.
|
|
bool | contains (Id const id) const |
| | Check if an element with the given id exists.
|
| T & | at (Id const id) const |
| | Get an element by id.
|
template<typename T>
class dsf::PtrMapView< T >
Non-owning view over a map of owning pointers, exposing (id, raw pointer) pairs.
The view does not expose the std::unique_ptr, so callers cannot reset or release the owned objects. If T is const, the objects are only accessible as const. The iterators only wrap the map's iterators, so they stay valid after the view itself is destroyed.
- Template Parameters
-
| T | The type of the owned objects, optionally const-qualified |
◆ at()
Get an element by id.
- Exceptions
-
| std::out_of_range | if no element with the given id exists |
The documentation for this class was generated from the following file:
- src/dsf/utility/PtrMapView.hpp