Files
cppdraft_translate/cppdraft/set/cons.md
2025-10-25 03:02:53 +03:00

2.3 KiB
Raw Blame History

[set.cons]

23 Containers library [containers]

23.4 Associative containers [associative]

23.4.6 Class template set [set]

23.4.6.2 Constructors, copy, and assignment [set.cons]

🔗

constexpr explicit set(const Compare& comp, const Allocator& = Allocator());

1

#

Effects: Constructs an empty set using the specified comparison object and allocator.

2

#

Complexity: Constant.

🔗

template<class InputIterator> constexpr set(InputIterator first, InputIterator last, const Compare& comp = Compare(), const Allocator& = Allocator());

3

#

Effects: Constructs an emptyset using the specified comparison object and allocator, and inserts elements from the range [first, last).

4

#

Complexity: Linear in N if the range [first, last) is already sorted with respect to comp and otherwise NlogN, where N islast - first.

🔗

template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<value_type> R> constexpr set(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator());

5

#

Effects: Constructs an empty set using the specified comparison object and allocator, and inserts elements from the range rg.

6

#

Complexity: Linear in N if rg is already sorted with respect to comp and otherwise NlogN, where N is ranges::distance(rg).