|
template<bool Tmp = OwnsIds, std::enable_if_t< Tmp, int > = 0> |
| IndexSkipMap (IdsContainer ids, Container &items) |
| Basic constructor for owning iterable. More...
|
|
template<bool Tmp = OwnsIds, std::enable_if_t<!Tmp, int > = 0> |
| IndexSkipMap (IdsContainer ids, Container &items) |
| Basic constructor for non-owning iterable. More...
|
|
auto | begin () |
| This function returns an iterator to the beginning of this filtered range. More...
|
|
auto | begin () const |
| This function returns a const_iterator to the beginning of this filtered range. More...
|
|
auto | cbegin () const |
| This function returns a const_iterator to the beginning of this filtered range. More...
|
|
auto | end () |
| This function returns an iterator to the end of this filtered range. More...
|
|
auto | end () const |
| This function returns a const_iterator to the end of this filtered range. More...
|
|
auto | cend () const |
| This function returns a const_iterator to the end of this filtered range. More...
|
|
auto | size () const |
| This function returns the size of the range covered. More...
|
|
template<typename IdsContainer, typename Container>
class AIToolbox::IndexSkipMap< IdsContainer, Container >
This class is an iterable construct on a list of ids on a given container.
This class allows to iterate over a given subset of ids on the input container as if they were laid out continuously in a single object.
Both ids and items must be stored in containers accessible via square-brakets and ids.
By default the iterable will copy the input ids and own them. If this is not desirable (maybe one wants to change the ids over time without being forced to copy them multiple times), the class accepts a pointer to an ids container, and it will automatically store a single reference to it, rather than doing a copy.
- Template Parameters
-
IdsContainer | The type of the input ids in the constructor. |
Container | The type of the container to be iterated on. |
template<typename IdsContainer , typename Container >
template<bool Tmp = OwnsIds, std::enable_if_t< Tmp, int > = 0>
Basic constructor for owning iterable.
This constructor stores a copy of all the ids and a reference to the container over which to iterate.
This class and its iterators do NOT perform any bound checking on the size of the container and the input ids, neither at construction nor during operation.
This class and its iterators WILL be invalidated if the item container is destroyed.
- Parameters
-
ids | The ids to iterate over. |
items | The items container. |
template<typename IdsContainer , typename Container >
template<bool Tmp = OwnsIds, std::enable_if_t<!Tmp, int > = 0>
Basic constructor for non-owning iterable.
This constructor stores the pointer to the ids and items over which to iterate.
This class and its iterators do NOT perform any bound checking on the size of the container and the input ids, neither at construction nor during operation.
This class and its iterators WILL be invalidated if the ids container or the item container are destroyed.
If the ids change, all previously generated iterators are invalidated.
- Parameters
-
ids | The ids to iterate over. |
items | The items container. |