Template Struct ordered_map

Inheritance Relationships

Base Type

  • public std::vector< std::pair< const Key, T >, std::allocator< std::pair< const Key, T > > >

Struct Documentation

template<class Key, class T, class IgnoredLess = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T>>>
struct ordered_map : public std::vector<std::pair<const Key, T>, std::allocator<std::pair<const Key, T>>>

a minimal map-like container that preserves insertion order

ordered_map: a minimal map-like container that preserves insertion order for use within nlohmann::basic_json<ordered_map>

Public Types

using key_type = Key
using mapped_type = T
using Container = std::vector<std::pair<const Key, T>, Allocator>
using iterator = typename Container::iterator
using const_iterator = typename Container::const_iterator
using size_type = typename Container::size_type
using value_type = typename Container::value_type
using key_compare = std::equal_to<Key>
template<typename InputIt>
using require_input_iter = typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIt>::iterator_category, std::input_iterator_tag>::value>::type

Public Functions

inline ordered_map() noexcept(noexcept(Container()))
inline explicit ordered_map(const Allocator &alloc) noexcept(noexcept(Container(alloc)))
template<class It>
inline ordered_map(It first, It last, const Allocator &alloc = Allocator())
inline ordered_map(std::initializer_list<value_type> init, const Allocator &alloc = Allocator())
inline std::pair<iterator, bool> emplace(const key_type &key, T &&t)
template<class KeyType, detail::enable_if_t<detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
inline std::pair<iterator, bool> emplace(KeyType &&key, T &&t)
inline T &operator[](const key_type &key)
template<class KeyType, detail::enable_if_t<detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
inline T &operator[](KeyType &&key)
inline const T &operator[](const key_type &key) const
template<class KeyType, detail::enable_if_t<detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
inline const T &operator[](KeyType &&key) const
inline T &at(const key_type &key)
template<class KeyType, detail::enable_if_t<detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
inline T &at(KeyType &&key)
inline const T &at(const key_type &key) const
template<class KeyType, detail::enable_if_t<detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
inline const T &at(KeyType &&key) const
inline size_type erase(const key_type &key)
template<class KeyType, detail::enable_if_t<detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
inline size_type erase(KeyType &&key)
inline iterator erase(iterator pos)
inline iterator erase(iterator first, iterator last)
inline size_type count(const key_type &key) const
template<class KeyType, detail::enable_if_t<detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
inline size_type count(KeyType &&key) const
inline iterator find(const key_type &key)
template<class KeyType, detail::enable_if_t<detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0>
inline iterator find(KeyType &&key)
inline const_iterator find(const key_type &key) const
inline std::pair<iterator, bool> insert(value_type &&value)
inline std::pair<iterator, bool> insert(const value_type &value)
template<typename InputIt, typename = require_input_iter<InputIt>>
inline void insert(InputIt first, InputIt last)