Class fixed_set

Synopsis

#include <include/EASTL/fixed_set.h>

template <typename Key, size_t nodeCount, bool bEnableOverflow = true, typename Compare = eastl::less<Key>, typename OverflowAllocator = EASTLAllocatorType>
class fixed_set : public set<Key, Compare, fixed_node_allocator<sizeof(typename set<Key>::node_type), 
							 nodeCount, EASTL_ALIGN_OF(Key), 0, bEnableOverflow, OverflowAllocator> >

Description

fixed_set

Implements a set with a fixed block of memory identified by the nodeCount template parameter.

Template parameters: Key The type of object the set holds (a.k.a. value). nodeCount The max number of objects to contain. bEnableOverflow Whether or not we should use the global heap if our object pool is exhausted. Compare Compare function/object for set ordering. OverflowAllocator Overflow allocator, which is only used if bEnableOverflow == true. Defaults to the global heap.

Mentioned in

Inheritance

Ancestors: set

Methods

fixed_set overloadfixed_set
get_overflow_allocator overload
max_size
operator= overload
reset_lose_memory
set_overflow_allocator
swap

Source

Lines 66-115 in include/EASTL/fixed_set.h.

template <typename Key, size_t nodeCount, bool bEnableOverflow = true, typename Compare = eastl::less<Key>, typename OverflowAllocator = EASTLAllocatorType>
class fixed_set : public set<Key, Compare, fixed_node_allocator<sizeof(typename set<Key>::node_type), 
                             nodeCount, EASTL_ALIGN_OF(Key), 0, bEnableOverflow, OverflowAllocator> >
{
public:
    typedef fixed_node_allocator<sizeof(typename set<Key>::node_type), nodeCount, 
                EASTL_ALIGN_OF(Key), 0, bEnableOverflow, OverflowAllocator>            fixed_allocator_type;
    typedef typename fixed_allocator_type::overflow_allocator_type                     overflow_allocator_type;
    typedef set<Key, Compare, fixed_allocator_type>                                    base_type;
    typedef fixed_set<Key, nodeCount, bEnableOverflow, Compare, OverflowAllocator>     this_type;
    typedef typename base_type::value_type                                             value_type;
    typedef typename base_type::node_type                                              node_type;
    typedef typename base_type::size_type                                              size_type;
    enum { kMaxSize = nodeCount };
    using base_type::insert;
protected:
    char mBuffer[fixed_allocator_type::kBufferSize]; // kBufferSize will take into account alignment requirements.
    using base_type::mAllocator;
    using base_type::get_compare;
public:
    fixed_set();
    fixed_set(const overflow_allocator_type& overflowAllocator);
    explicit fixed_set(const Compare& compare);
    fixed_set(const this_type& x);
    fixed_set(this_type&& x);
    fixed_set(this_type&& x, const overflow_allocator_type& overflowAllocator);
    fixed_set(std::initializer_list<value_type> ilist, const overflow_allocator_type& overflowAllocator = EASTL_FIXED_SET_DEFAULT_ALLOCATOR);
    template <typename InputIterator>
    fixed_set(InputIterator first, InputIterator last);
    this_type& operator=(const this_type& x);
    this_type& operator=(std::initializer_list<value_type> ilist);
    this_type& operator=(this_type&& x);
    void swap(this_type& x);
    void reset_lose_memory(); // This is a unilateral reset to an initially empty state. No destructors are called, no deallocation occurs.
    size_type max_size() const;
    const overflow_allocator_type& get_overflow_allocator() const EA_NOEXCEPT;
    overflow_allocator_type&       get_overflow_allocator() EA_NOEXCEPT;
    void                           set_overflow_allocator(const overflow_allocator_type& allocator);
}; // fixed_set





Add Discussion as Guest

Log in