Description

flat_set is a Sorted Associative Container that stores objects of type Key. flat_set is a Simple Associative Container, meaning that its value type, as well as its key type, is Key. It is also a Unique Associative Container, meaning that no two elements are the same.

flat_set is similar to std::set but it's implemented like an ordered vector. This means that inserting a new element into a flat_set invalidates previous iterators and references

Erasing an element of a flat_set invalidates iterators and references pointing to elements that come after (their keys are bigger) the erased element.

Effects: Constructs an empty flat_set using the specified comparison object and allocator, and inserts elements from the ordered unique range [first ,last). This function is more efficient than the normal range creation for ordered ranges.

Requires: [first ,last) must be ordered according to the predicate and must be unique values.

flat_set public member functions

Effects: Returns a copy of the Allocator that was passed to the object's constructor.

Complexity: Constant.

stored_allocator_type&get_stored_allocator();

Effects: Returns a reference to the internal allocator.

Throws: Nothing

Complexity: Constant.

Note: Non-standard extension.

conststored_allocator_type&get_stored_allocator()const;

Effects: Returns a reference to the internal allocator.

Throws: Nothing

Complexity: Constant.

Note: Non-standard extension.

iteratorbegin();

Effects: Returns an iterator to the first element contained in the container.

Throws: Nothing.

Complexity: Constant.

const_iteratorbegin()const;

Effects: Returns a const_iterator to the first element contained in the container.

Throws: Nothing.

Complexity: Constant.

iteratorend();

Effects: Returns an iterator to the end of the container.

Throws: Nothing.

Complexity: Constant.

const_iteratorend()const;

Effects: Returns a const_iterator to the end of the container.

Throws: Nothing.

Complexity: Constant.

reverse_iteratorrbegin();

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Throws: Nothing.

Complexity: Constant.

const_reverse_iteratorrbegin()const;

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Throws: Nothing.

Complexity: Constant.

reverse_iteratorrend();

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Throws: Nothing.

Complexity: Constant.

const_reverse_iteratorrend()const;

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Throws: Nothing.

Complexity: Constant.

const_iteratorcbegin()const;

Effects: Returns a const_iterator to the first element contained in the container.

Throws: Nothing.

Complexity: Constant.

const_iteratorcend()const;

Effects: Returns a const_iterator to the end of the container.

Throws: Nothing.

Complexity: Constant.

const_reverse_iteratorcrbegin()const;

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Throws: Nothing.

Complexity: Constant.

const_reverse_iteratorcrend()const;

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Throws: Nothing.

Complexity: Constant.

boolempty()const;

Effects: Returns true if the container contains no elements.

Throws: Nothing.

Complexity: Constant.

size_typesize()const;

Effects: Returns the number of the elements contained in the container.

Throws: Nothing.

Complexity: Constant.

size_typemax_size()const;

Effects: Returns the largest possible size of the container.

Throws: Nothing.

Complexity: Constant.

size_typecapacity()const;

Effects: Number of elements for which memory has been allocated. capacity() is always greater than or equal to size().

Throws: Nothing.

Complexity: Constant.

voidreserve(size_type cnt);

Effects: If n is less than or equal to capacity(), this call has no effect. Otherwise, it is a request for allocation of additional memory. If the request is successful, then capacity() is greater than or equal to n; otherwise, capacity() is unchanged. In either case, size() is unchanged.

Effects: Inserts an object of type Key constructed with std::forward<Args>(args)... in the container if and only if there is no element in the container with key equivalent to the key of x. p is a hint pointing to where the insert should start to search.

Returns: An iterator pointing to the element with key equivalent to the key of x.

Complexity: Logarithmic search time (constant if x is inserted right before p) plus insertion linear to the elements with bigger keys than x.

Note: If an element is inserted it might invalidate elements.

std::pair<iterator,bool>insert(constvalue_type& x);

Effects: Inserts x if and only if there is no element in the container with key equivalent to the key of x.

Returns: The bool component of the returned pair is true if and only if the insertion takes place, and the iterator component of the pair points to the element with key equivalent to the key of x.

Complexity: Logarithmic search time plus linear insertion to the elements with bigger keys than x.

Note: If an element is inserted it might invalidate elements.

std::pair<iterator,bool>insert(value_type&& x);

Effects: Inserts a new value_type move constructed from the pair if and only if there is no element in the container with key equivalent to the key of x.

Returns: The bool component of the returned pair is true if and only if the insertion takes place, and the iterator component of the pair points to the element with key equivalent to the key of x.

Complexity: Logarithmic search time plus linear insertion to the elements with bigger keys than x.

Note: If an element is inserted it might invalidate elements.

iteratorinsert(const_iterator p,constvalue_type& x);

Effects: Inserts a copy of x in the container if and only if there is no element in the container with key equivalent to the key of x. p is a hint pointing to where the insert should start to search.

Returns: An iterator pointing to the element with key equivalent to the key of x.

Complexity: Logarithmic search time (constant if x is inserted right before p) plus insertion linear to the elements with bigger keys than x.

Note: If an element is inserted it might invalidate elements.

iteratorinsert(const_iterator position,value_type&& x);

Effects: Inserts an element move constructed from x in the container. p is a hint pointing to where the insert should start to search.

Returns: An iterator pointing to the element with key equivalent to the key of x.

Complexity: Logarithmic search time (constant if x is inserted right before p) plus insertion linear to the elements with bigger keys than x.