xtd 0.2.0
Loading...
Searching...
No Matches

◆ sorted_set

template<typename type_t >
using xtd::collections::generic::sorted_set = typedef std::set<type_t, helpers::comparer<type_t>, helpers::allocator<type_t> >

Represents a collection of objects that is maintained in sorted order.

Definition
template<typename type_t>
using sorted_set = std::set<type_t, helpers::comparer<type_t>, helpers::allocator<type_t>>;
std::set< type_t, helpers::comparer< type_t >, helpers::allocator< type_t > > sorted_set
Represents a collection of objects that is maintained in sorted order.
Definition sorted_set.h:36
std::allocator< type_t > allocator
Represent an allocator alias.
Definition allocator.h:35
Header
#include <xtd/collections/sorted_set
Namespace
xtd::collections::generic
Library
xtd.core
Remarks
The xtd::collections::generic::sorted_set class is same as std::set.
A xtd::collections::generic::sorted_set object maintains a sorted order without affecting performance as elements are inserted and deleted. Duplicate elements are ! allowed. Changing the sort values of existing items is ! supported and may lead to unexpected behavior.
Examples
The following example demonstrates how to merge two disparate sets. This example creates two xtd::collections::generic::sorted_set objects, and populates them with even and odd numbers, respectively. A third xtd::collections::generic::sorted_set object is created from the set that contains the even numbers. The example then calls the UnionWith method, which adds the odd number set to the third set.