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

6.0 KiB
Raw Permalink Blame History

[hive.modifiers]

23 Containers library [containers]

23.3 Sequence containers [sequences]

23.3.9 Class template hive [hive]

23.3.9.4 Modifiers [hive.modifiers]

🔗

template<class... Args> iterator emplace(Args&&... args); template<class... Args> iterator emplace_hint(const_iterator hint, Args&&... args);

1

#

Preconditions: T is Cpp17EmplaceConstructible into hive from args.

2

#

Effects: Inserts an object of type T constructed with std::forward(args)....

The hint parameter is ignored.

If an exception is thrown, there are no effects.

[Note 1:

args can directly or indirectly refer to a value in *this.

— end note]

3

#

Returns: An iterator that points to the new element.

4

#

Complexity: Constant.

Exactly one object of type T is constructed.

5

#

Remarks: Invalidates the past-the-end iterator.

🔗

iterator insert(const T& x); iterator insert(const_iterator hint, const T& x); iterator insert(T&& x); iterator insert(const_iterator hint, T&& x);

6

#

Effects: Equivalent to: return emplace(std::forward<decltype(x)>(x));

[Note 2:

The hint parameter is ignored.

— end note]

🔗

void insert(initializer_list<T> rg); template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<T> R> void insert_range(R&& rg);

7

#

Preconditions: T is Cpp17EmplaceInsertable into hive from *ranges::begin(rg).

rg and *this do not overlap.

8

#

Effects: Inserts copies of elements in rg.

Each iterator in the range rg is dereferenced exactly once.

9

#

Complexity: Linear in the number of elements inserted.

Exactly one object of type T is constructed for each element inserted.

10

#

Remarks: If an element is inserted, invalidates the past-the-end iterator.

🔗

void insert(size_type n, const T& x);

11

#

Preconditions: T is Cpp17CopyInsertable into hive.

12

#

Effects: Inserts n copies of x.

13

#

Complexity: Linear in n.

Exactly one object of type T is constructed for each element inserted.

14

#

Remarks: If an element is inserted, invalidates the past-the-end iterator.

🔗

template<class InputIterator> void insert(InputIterator first, InputIterator last);

15

#

Effects: Equivalent to insert_range(ranges::subrange(first, last)).

🔗

iterator erase(const_iterator position); iterator erase(const_iterator first, const_iterator last);

16

#

Complexity: Linear in the number of elements erased.

Additionally, if any active blocks become empty of elements as a result of the function call, at worst linear in the number of element blocks.

17

#

Remarks: Invalidates references, pointers and iterators referring to the erased elements.

An erase operation that erases the last element in *this also invalidates the past-the-end iterator.

🔗

void swap(hive& x) noexcept(allocator_traits<Allocator>::propagate_on_container_swap::value || allocator_traits<Allocator>::is_always_equal::value);

18

#

Effects: Exchanges the contents, capacity(), and current-limits of *this with that of x.

19

#

Complexity: Constant.