userver: userver/utils/projected_set.hpp File Reference
Loading...
Searching...
No Matches
projected_set.hpp File Reference

Detailed Description

A std::unordered_set that compares its elements (of type Value) based on their Projection. It allows to create, essentially, an equivalent of std::unordered_map where keys are stored inside values.

Definition in file projected_set.hpp.

Go to the source code of this file.

#include <functional>
#include <set>
#include <type_traits>
#include <unordered_set>

Namespaces

namespace  utils
 Utilities.
 

Typedefs

template<typename Value , auto Projection, typename Hash = void, typename Equal = std::equal_to<>, typename Allocator = std::allocator<Value>>
using utils::ProjectedUnorderedSet
 A std::unordered_set that compares its elements (of type Value) based on their Projection. It allows to create, essentially, an equivalent of std::unordered_map where keys are stored inside values.
 
template<typename Value , auto Projection, typename Compare = std::less<>, typename Allocator = std::allocator<Value>>
using utils::ProjectedSet
 Same as ProjectedUnorderedSet, but for std::set.
 

Functions

template<typename Container , typename Value >
void utils::ProjectedInsertOrAssign (Container &set, Value &&value)
 An equivalent of std::unordered_map::insert_or_assign for utils::ProjectedUnorderedSet and utils::ProjectedSet.