Container Utils

vtr_hash

namespace vtr

Functions

template<class T>
inline void hash_combine(std::size_t &seed, const T &v)

Hashes v and combines it with seed (as in boost)

This is typically used to implement std::hash for composite types.

struct hash_pair
#include <vtr_hash.h>

Public Functions

template<class T1, class T2>
inline std::size_t operator()(const std::pair<T1, T2> &pair) const noexcept

vtr_memory

namespace vtr

Functions

template<typename Container>
void release_memory(Container &container)

This function will force the container to be cleared.

It releases its held memory. For efficiency, STL containers usually don’t release their actual heap-allocated memory until destruction (even if Container::clear() is called).

vtr_pair_util

namespace vtr
template<typename PairIter>
class pair_first_iter
#include <vtr_pair_util.h>

Iterator which dereferences the ‘first’ element of a std::pair iterator.

Public Functions

inline pair_first_iter(PairIter init)

constructor

inline auto operator++()

increment operator (++)

inline auto operator--()

decrement operator (–)

inline auto operator*()

dereference * operator

inline auto operator->()

-> operator

template<typename PairIter>
class pair_second_iter
#include <vtr_pair_util.h>

Iterator which dereferences the ‘second’ element of a std::pair iterator

Public Functions

inline pair_second_iter(PairIter init)

constructor

inline auto operator++()

increment operator (++)

inline auto operator--()

decrement operator (&#8212;)

inline auto operator*()

dereference * operator

inline auto operator->()

-> operator

vtr_map_util

namespace vtr

Typedefs

template<typename Iter>
using map_key_iter = pair_first_iter<Iter>

An iterator who wraps a std::map iterator to return it’s key.

template<typename Iter>
using map_value_iter = pair_second_iter<Iter>

An iterator who wraps a std::map iterator to return it’s value.

Functions

template<typename T>
auto make_key_range(T b, T e)

Returns a range iterating over a std::map’s keys.

template<typename Container>
auto make_key_range(const Container &c)

Returns a range iterating over a std::map’s keys.

template<typename T>
auto make_value_range(T b, T e)

Returns a range iterating over a std::map’s values.

template<typename Container>
auto make_value_range(const Container &c)

Returns a range iterating over a std::map’s values.