userver: userver/utils/projected_set.hpp File Reference
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
projected_set.hpp File Reference

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. More...

#include <functional>
#include <set>
#include <type_traits>
#include <unordered_set>
+ Include dependency graph for projected_set.hpp:

Go to the source code of this file.

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 = std::unordered_set< Value, impl::projected_set::Hash< Value, Projection, Hash >, impl::projected_set::Compare< Value, Projection, Equal >, Allocator >
 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 = std::set< Value, impl::projected_set::Compare< Value, Projection, Compare >, Allocator >
 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.
 

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.