P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::flat_map< K, V, Compare, Container > Struct Template Reference

#include <flat_map.h>

Classes

struct  value_compare
 

Public Types

using allocator_type = typename Container::allocator_type
 
using const_iterator = typename Container::const_iterator
 
using const_pointer = typename Container::const_pointer
 
using const_reference = typename Container::const_reference
 
using const_reverse_iterator = typename Container::const_reverse_iterator
 
using difference_type = typename Container::difference_type
 
using iterator = typename Container::iterator
 
using key_compare = Compare
 
using key_type = K
 
using mapped_type = V
 
using pointer = typename Container::pointer
 
using reference = typename Container::reference
 
using reverse_iterator = typename Container::reverse_iterator
 
using size_type = typename Container::size_type
 
using value_type = typename Container::value_type
 

Public Member Functions

template<typename It >
 flat_map (It begin, It end)
 
 flat_map (std::initializer_list< value_type > il)
 
template<class Key >
mapped_type & at (const Key &key)
 
template<class Key >
const mapped_type & at (const Key &key) const
 
iterator begin ()
 
const_iterator begin () const
 
size_type bytes_used () const
 
size_type capacity () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
void clear ()
 
template<typename T >
size_type count (const T &key) const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
std::pair< iterator, bool > emplace ()
 
template<typename First , typename... Args>
std::pair< iterator, bool > emplace (First &&first, Args &&...args)
 
iterator emplace_hint (const_iterator hint)
 
template<typename First , typename... Args>
iterator emplace_hint (const_iterator hint, First &&first, Args &&...args)
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
template<typename T >
std::pair< iterator, iterator > equal_range (const T &key)
 
template<typename T >
std::pair< const_iterator, const_iterator > equal_range (const T &key) const
 
size_type erase (const key_type &key)
 
iterator erase (const_iterator first, const_iterator last)
 
iterator erase (const_iterator it)
 
iterator erase (iterator it)
 
template<typename T >
iterator find (const T &key)
 
template<typename T >
const_iterator find (const T &key) const
 
allocator_type get_allocator () const
 
std::pair< iterator, bool > insert (const value_type &value)
 
iterator insert (const_iterator hint, const value_type &value)
 
iterator insert (const_iterator hint, value_type &&value)
 
template<typename It >
void insert (It begin, It end)
 
void insert (std::initializer_list< value_type > il)
 
std::pair< iterator, bool > insert (value_type &&value)
 
key_compare key_comp () const
 
template<typename T >
iterator lower_bound (const T &key)
 
template<typename T >
const_iterator lower_bound (const T &key) const
 
size_type max_size () const
 
bool operator!= (const flat_map &other) const
 
bool operator< (const flat_map &other) const
 
bool operator<= (const flat_map &other) const
 
bool operator== (const flat_map &other) const
 
bool operator> (const flat_map &other) const
 
bool operator>= (const flat_map &other) const
 
mapped_type & operator[] (const key_type &key)
 
mapped_type & operator[] (key_type &&key)
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
void reserve (size_type size)
 
void shrink_to_fit ()
 
size_type size () const
 
void swap (flat_map &other)
 
template<typename T >
iterator upper_bound (const T &key)
 
template<typename T >
const_iterator upper_bound (const T &key) const
 
value_compare value_comp () const
 

Detailed Description

template<typename K, typename V, typename Compare = std::less<>, typename Container = std::vector<std::pair<K, V>>>
struct P4::flat_map< K, V, Compare, Container >

A header-only implementation of a memory-efficient flat_map. TODO: Replace this map with std::flat_map once available in C++23: https://en.cppreference.com/w/cpp/container/flat_map