Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZStd::set< Key, Compare, Allocator > Class Template Reference

#include <set.h>

Public Types

using traits_type = typename tree_type::traits_type
 
using key_type = typename tree_type::key_type
 
using value_type = typename tree_type::value_type
 
using key_compare = typename tree_type::key_equal
 
using value_compare = typename tree_type::key_equal
 
using allocator_type = typename tree_type::allocator_type
 
using size_type = typename tree_type::size_type
 
using difference_type = typename tree_type::difference_type
 
using pointer = typename tree_type::pointer
 
using const_pointer = typename tree_type::const_pointer
 
using reference = typename tree_type::reference
 
using const_reference = typename tree_type::const_reference
 
using iterator = typename tree_type::iterator
 
using const_iterator = typename tree_type::const_iterator
 
using reverse_iterator = typename tree_type::reverse_iterator
 
using const_reverse_iterator = typename tree_type::const_reverse_iterator
 
using node_type = set_node_handle< set_node_traits< value_type, allocator_type, typename tree_type::node_type, typename tree_type::node_deleter > >
 
using insert_return_type = AssociativeInternal::insert_return_type< iterator, node_type >
 

Public Member Functions

 set (const Compare &comp, const Allocator &alloc=Allocator())
 
template<class InputIterator >
 set (InputIterator first, InputIterator last, const Compare &comp=Compare(), const Allocator &alloc=Allocator())
 
template<class R , class = enable_if_t<Internal::container_compatible_range<R, value_type>>>
 set (from_range_t, R &&rg, const Compare &comp=Compare(), const Allocator &alloc=Allocator())
 
 set (const set &rhs)
 
 set (set &&rhs)
 
 set (const Allocator &alloc)
 
 set (const set &rhs, const type_identity_t< Allocator > &alloc)
 
 set (set &&rhs, const type_identity_t< Allocator > &alloc)
 
 set (initializer_list< value_type > list, const Compare &comp=Compare(), const Allocator &alloc=Allocator())
 
template<class InputIterator >
 set (InputIterator first, InputIterator last, const Allocator &alloc)
 
template<class R , class = enable_if_t<Internal::container_compatible_range<R, value_type>>>
 set (from_range_t, R &&rg, const Allocator &a)
 
 set (initializer_list< value_type > list, const Allocator &alloc)
 
AZ_FORCE_INLINE this_typeoperator= (const this_type &rhs)
 
AZ_FORCE_INLINE key_compare key_comp () const
 
AZ_FORCE_INLINE value_compare value_comp () const
 
AZ_FORCE_INLINE iterator begin ()
 
AZ_FORCE_INLINE iterator end ()
 
AZ_FORCE_INLINE const_iterator begin () const
 
AZ_FORCE_INLINE const_iterator end () const
 
AZ_FORCE_INLINE reverse_iterator rbegin ()
 
AZ_FORCE_INLINE reverse_iterator rend ()
 
AZ_FORCE_INLINE const_reverse_iterator rbegin () const
 
AZ_FORCE_INLINE const_reverse_iterator rend () const
 
AZ_FORCE_INLINE bool empty () const
 
AZ_FORCE_INLINE size_type size () const
 
AZ_FORCE_INLINE size_type max_size () const
 
AZ_FORCE_INLINE void swap (this_type &rhs)
 
AZ_FORCE_INLINE pair< iterator, bool > insert (const value_type &value)
 
AZ_FORCE_INLINE iterator insert (iterator insertPos, const value_type &value)
 
template<class InputIterator >
void insert (InputIterator first, InputIterator last)
 
template<class R >
auto insert_range (R &&rg) -> enable_if_t< Internal::container_compatible_range< R, value_type > >
 
this_typeoperator= (this_type &&rhs)
 
AZStd::pair< iterator, bool > insert (value_type &&value)
 
iterator insert (const_iterator insertPos, value_type &&value)
 
template<class ... InputArguments>
AZStd::pair< iterator, bool > emplace (InputArguments &&... arguments)
 
template<class ... InputArguments>
iterator emplace_hint (const_iterator insertPos, InputArguments &&... arguments)
 
insert_return_type insert (node_type &&nodeHandle)
 
iterator insert (const_iterator hint, node_type &&nodeHandle)
 
node_type extract (const key_type &key)
 
node_type extract (const_iterator it)
 
AZ_FORCE_INLINE iterator erase (const_iterator erasePos)
 
AZ_FORCE_INLINE size_type erase (const key_type &key)
 
AZ_FORCE_INLINE iterator erase (const_iterator first, const_iterator last)
 
AZ_FORCE_INLINE void clear ()
 
const_iterator find (const key_type &key) const
 
iterator find (const key_type &key)
 
bool contains (const key_type &key) const
 
size_type count (const key_type &key) const
 
iterator lower_bound (const key_type &key)
 
const_iterator lower_bound (const key_type &key) const
 
iterator upper_bound (const key_type &key)
 
const_iterator upper_bound (const key_type &key) const
 
pair< iterator, iterator > equal_range (const key_type &key)
 
pair< const_iterator, const_iterator > equal_range (const key_type &key) const
 
template<typename ComparableToKey >
auto find (const ComparableToKey &key) const -> enable_if_t<::AZStd::Internal::is_transparent< key_compare, ComparableToKey >::value, const_iterator >
 
template<typename ComparableToKey >
auto find (const ComparableToKey &key) -> enable_if_t<::AZStd::Internal::is_transparent< key_compare, ComparableToKey >::value, iterator >
 
template<typename ComparableToKey >
auto contains (const ComparableToKey &key) const -> enable_if_t<::AZStd::Internal::is_transparent< key_compare, ComparableToKey >::value, bool >
 
template<typename ComparableToKey >
auto count (const ComparableToKey &key) const -> enable_if_t<::AZStd::Internal::is_transparent< key_compare, ComparableToKey >::value, size_type >
 
template<typename ComparableToKey >
auto lower_bound (const ComparableToKey &key) -> enable_if_t<::AZStd::Internal::is_transparent< key_compare, ComparableToKey >::value, iterator >
 
template<typename ComparableToKey >
auto lower_bound (const ComparableToKey &key) const -> enable_if_t<::AZStd::Internal::is_transparent< key_compare, ComparableToKey >::value, const_iterator >
 
template<typename ComparableToKey >
auto upper_bound (const ComparableToKey &key) -> enable_if_t<::AZStd::Internal::is_transparent< key_compare, ComparableToKey >::value, iterator >
 
template<typename ComparableToKey >
auto upper_bound (const ComparableToKey &key) const -> enable_if_t<::AZStd::Internal::is_transparent< key_compare, ComparableToKey >::value, const_iterator >
 
template<typename ComparableToKey >
auto equal_range (const ComparableToKey &key) -> enable_if_t<::AZStd::Internal::is_transparent< key_compare, ComparableToKey >::value, pair< iterator, iterator > >
 
template<typename ComparableToKey >
auto equal_range (const ComparableToKey &key) const -> enable_if_t<::AZStd::Internal::is_transparent< key_compare, ComparableToKey >::value, pair< const_iterator, const_iterator > >
 
Extensions

AZ_FORCE_INLINE allocator_type & get_allocator ()
 
AZ_FORCE_INLINE const allocator_type & get_allocator () const
 
AZ_FORCE_INLINE void set_allocator (const allocator_type &allocator)
 Set the vector allocator. If different than then current all elements will be reallocated.
 
AZ_INLINE bool validate () const
 
AZ_INLINE int validate_iterator (const const_iterator &iter) const
 Validates an iter iterator. Returns a combination of iterator_status_flag.
 
AZ_INLINE int validate_iterator (const iterator &iter) const
 
AZ_FORCE_INLINE void leak_and_reset ()
 

Detailed Description

template<class Key, class Compare = AZStd::less<Key>, class Allocator = AZStd::allocator>
class AZStd::set< Key, Compare, Allocator >

Ordered set container is complaint with C++0x (23.4.3) This is an associative container, all keys are unique. insert function will return false, if you try to add key that is in the set.

Check the set AZStdExamples.

Member Function Documentation

◆ leak_and_reset()

template<class Key , class Compare = AZStd::less<Key>, class Allocator = AZStd::allocator>
AZ_FORCE_INLINE void AZStd::set< Key, Compare, Allocator >::leak_and_reset ( )
inline

Resets the container without deallocating any memory or calling any destructor. This function should be used when we need very quick tear down. Generally it's used for temporary vectors and we can just nuke them that way. In addition the provided Allocators, has leak and reset flag which will enable automatically this behavior. So this function should be used in special cases AZStdExamples.

Note
This function is added to the vector for consistency. In the vector case we have only one allocation, and if the allocator allows memory leaks it can just leave deallocate function empty, which performance wise will be the same. For more complex containers this will make big difference.

The documentation for this class was generated from the following files: