P4C
The P4 Compiler
Loading...
Searching...
No Matches
assoc::set< Key, Compare, Allocator, Itble > Class Template Reference

#include <assoc.h>

Inheritance diagram for assoc::set< Key, Compare, Allocator, Itble >:
[legend]

Public Member Functions

 set (std::initializer_list< typename Base::value_type > init, const Compare &comp=Compare(), const Allocator &alloc=Allocator())
 
void swap (set &other)
 
const std::set< Key, Compare, Allocator > & unstable_iterable () const
 
- Public Member Functions inherited from assoc::detail::CondIterableAssoc< Base, Itble >
const_iterator begin () const noexcept
 
iterator begin () noexcept
 
const_iterator cbegin () const noexcept
 
bool contains (const key_type &key) const
 
const_reverse_iterator crbegin () const noexcept
 
std::pair< iterator, iterator > equal_range (const key_type &key)
 
std::pair< const iterator, const_iterator > equal_range (const key_type &key) const
 
iterator lower_bound (const key_type &key)
 
const_iterator lower_bound (const key_type &key) const
 
const_reverse_iterator rbegin () const noexcept
 
reverse_iterator rbegin () noexcept
 
const_iterator unstable_begin () const noexcept
 
iterator unstable_begin () noexcept
 
const_iterator unstable_cbegin () const noexcept
 
iterator upper_bound (const key_type &key)
 
const_iterator upper_bound (const key_type &key) const
 

Additional Inherited Members

- Public Types inherited from assoc::detail::CondIterableAssoc< Base, Itble >
using allocator_type = typename Base::allocator_type
 
using const_iterator = typename Base::const_iterator
 
using const_pointer = typename Base::const_pointer
 
using const_reference = typename Base::const_reference
 
using const_reverse_iterator = typename Base::const_reverse_iterator
 
using difference_type = typename Base::difference_type
 
using iterator = typename Base::iterator
 
using key_type = typename Base::key_type
 
using pointer = typename Base::pointer
 
using reference = typename Base::reference
 
using reverse_iterator = typename Base::reverse_iterator
 
using size_type = typename Base::size_type
 
using value_type = typename Base::value_type
 
- Public Types inherited from assoc::detail::CondIterableAssocBase< Base, Itble, typename >
using hasher = typename Base::hasher
 
using key_equal = typename Base::key_equal
 
- Static Public Attributes inherited from assoc::detail::CondIterableAssocBase< Base, Itble, typename >
static constexpr bool iterable = Itble == Iterable::Yes
 
- Protected Member Functions inherited from assoc::detail::CondIterableAssoc< Base, Itble >
void _ensure_iterable () const
 

Detailed Description

template<typename Key, typename Compare = std::less<Key>, typename Allocator = std::allocator<Key>, Iterable Itble = Iterable::Auto>
class assoc::set< Key, Compare, Allocator, Itble >

Works just like a normal std::set, except it cannot be iterated over if the key is not stable (unless explicitly overridden by the last template parameter or preferably use of iterable_set or non_iterable_set).

See also
namespace assoc

Member Function Documentation

◆ unstable_iterable()

template<typename Key , typename Compare = std::less<Key>, typename Allocator = std::allocator<Key>, Iterable Itble = Iterable::Auto>
const std::set< Key, Compare, Allocator > & assoc::set< Key, Compare, Allocator, Itble >::unstable_iterable ( ) const
inline

Extract an iterable that can be iterated over even if this container is not iterable. This is intended for targeted use at places where it is actually safe to iterate over a container with unspecified order – i.e. in cases where the result does in no way depend on the iteration order. An example can be checking if a given value is present in the map.