This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

View File

@@ -0,0 +1,103 @@
[inplace.vector.capacity]
# 23 Containers library [[containers]](./#containers)
## 23.3 Sequence containers [[sequences]](sequences#inplace.vector.capacity)
### 23.3.16 Class template inplace_vector [[inplace.vector]](inplace.vector#capacity)
#### 23.3.16.3 Capacity [inplace.vector.capacity]
[🔗](#lib:capacity,inplace_vector)
`static constexpr size_type capacity() noexcept;
static constexpr size_type max_size() noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11001)
*Returns*: N[.](#1.sentence-1)
[🔗](#lib:resize,inplace_vector)
`constexpr void resize(size_type sz);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11012)
*Preconditions*: T is *Cpp17DefaultInsertable* into inplace_vector[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11016)
*Effects*: If sz < size(),
erases the last size() - sz elements from the sequence[.](#3.sentence-1)
Otherwise,
appends sz - size() default-inserted elements to the sequence[.](#3.sentence-2)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11024)
*Remarks*: If an exception is thrown, there are no effects on *this[.](#4.sentence-1)
[🔗](#lib:resize,inplace_vector_)
`constexpr void resize(size_type sz, const T& c);
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11035)
*Preconditions*: T is *Cpp17CopyInsertable* into inplace_vector[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11039)
*Effects*: If sz < size(),
erases the last size() - sz elements from the sequence[.](#6.sentence-1)
Otherwise,
appends sz - size() copies of c to the sequence[.](#6.sentence-2)
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11047)
*Remarks*: If an exception is thrown, there are no effects on *this[.](#7.sentence-1)
[🔗](#lib:reserve,inplace_vector)
`static constexpr void reserve(size_type n);
`
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11058)
*Effects*: None[.](#8.sentence-1)
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11062)
*Throws*: bad_alloc if n > capacity() is true[.](#9.sentence-1)
[🔗](#lib:shrink_to_fit,inplace_vector)
`static constexpr void shrink_to_fit() noexcept;
`
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11073)
*Effects*: None[.](#10.sentence-1)

View File

@@ -0,0 +1,92 @@
[inplace.vector.cons]
# 23 Containers library [[containers]](./#containers)
## 23.3 Sequence containers [[sequences]](sequences#inplace.vector.cons)
### 23.3.16 Class template inplace_vector [[inplace.vector]](inplace.vector#cons)
#### 23.3.16.2 Constructors [inplace.vector.cons]
[🔗](#lib:inplace_vector,constructor)
`constexpr explicit inplace_vector(size_type n);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L10926)
*Preconditions*: T is *Cpp17DefaultInsertable* into inplace_vector[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L10930)
*Effects*: Constructs an inplace_vector with n default-inserted elements[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L10934)
*Complexity*: Linear in n[.](#3.sentence-1)
[🔗](#lib:inplace_vector,constructor_)
`constexpr inplace_vector(size_type n, const T& value);
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L10945)
*Preconditions*: T is *Cpp17CopyInsertable* into inplace_vector[.](#4.sentence-1)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L10949)
*Effects*: Constructs an inplace_vector with n copies of value[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L10953)
*Complexity*: Linear in n[.](#6.sentence-1)
[🔗](#lib:inplace_vector,constructor__)
`template<class InputIterator>
constexpr inplace_vector(InputIterator first, InputIterator last);
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L10965)
*Effects*: Constructs an inplace_vector equal to the range [first, last)[.](#7.sentence-1)
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L10969)
*Complexity*: Linear in distance(first, last)[.](#8.sentence-1)
[🔗](#lib:inplace_vector,constructor___)
`template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<T> R>
constexpr inplace_vector(from_range_t, R&& rg);
`
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L10981)
*Effects*: Constructs an inplace_vector with
the elements of the range rg[.](#9.sentence-1)
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L10986)
*Complexity*: Linear in ranges::distance(rg)[.](#10.sentence-1)

View File

@@ -0,0 +1,29 @@
[inplace.vector.data]
# 23 Containers library [[containers]](./#containers)
## 23.3 Sequence containers [[sequences]](sequences#inplace.vector.data)
### 23.3.16 Class template inplace_vector [[inplace.vector]](inplace.vector#data)
#### 23.3.16.4 Data [inplace.vector.data]
[🔗](#lib:data,inplace_vector)
`constexpr T* data() noexcept;
constexpr const T* data() const noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11087)
*Returns*: A pointer such that [data(), data() + size()) is a valid range[.](#1.sentence-1)
For a non-empty inplace_vector,data() == addressof(front()) is true[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11093)
*Complexity*: Constant time[.](#2.sentence-1)

View File

@@ -0,0 +1,35 @@
[inplace.vector.erasure]
# 23 Containers library [[containers]](./#containers)
## 23.3 Sequence containers [[sequences]](sequences#inplace.vector.erasure)
### 23.3.16 Class template inplace_vector [[inplace.vector]](inplace.vector#erasure)
#### 23.3.16.6 Erasure [inplace.vector.erasure]
[🔗](#lib:erase,inplace_vector)
`template<class T, size_t N, class U = T>
constexpr size_t erase(inplace_vector<T, N>& c, const U& value);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11330)
*Effects*: Equivalent to:auto it = remove(c.begin(), c.end(), value);auto r = distance(it, c.end());
c.erase(it, c.end());return r;
[🔗](#lib:erase_if,inplace_vector)
`template<class T, size_t N, class Predicate>
constexpr size_t erase_if(inplace_vector<T, N>& c, Predicate pred);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11348)
*Effects*: Equivalent to:auto it = remove_if(c.begin(), c.end(), pred);auto r = distance(it, c.end());
c.erase(it, c.end());return r;

View File

@@ -0,0 +1,268 @@
[inplace.vector.modifiers]
# 23 Containers library [[containers]](./#containers)
## 23.3 Sequence containers [[sequences]](sequences#inplace.vector.modifiers)
### 23.3.16 Class template inplace_vector [[inplace.vector]](inplace.vector#modifiers)
#### 23.3.16.5 Modifiers [inplace.vector.modifiers]
[🔗](#lib:insert,inplace_vector)
`constexpr iterator insert(const_iterator position, const T& x);
constexpr iterator insert(const_iterator position, T&& x);
constexpr iterator insert(const_iterator position, size_type n, const T& x);
template<class InputIterator>
constexpr iterator insert(const_iterator position, InputIterator first, InputIterator last);
template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<T> R>
constexpr iterator insert_range(const_iterator position, R&& rg);
constexpr iterator insert(const_iterator position, initializer_list<T> il);
template<class... Args>
constexpr iterator emplace(const_iterator position, Args&&... args);
template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<T> R>
constexpr void append_range(R&& rg);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11121)
Let n be the value of size() before this call for
the append_range overload, anddistance(begin, position) otherwise[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11126)
*Complexity*: Linear in the number of elements inserted plus
the distance to the end of the vector[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11131)
*Remarks*: If an exception is thrown other than by the
copy constructor,
move constructor,
assignment operator, or
move assignment operator
of T or by
any InputIterator operation,
there are no effects[.](#3.sentence-1)
Otherwise,
if an exception is thrown, thensize() ≥ n and
elements in the range begin() + [0, n) are not modified[.](#3.sentence-2)
[🔗](#lib:push_back,inplace_vector)
`constexpr reference push_back(const T& x);
constexpr reference push_back(T&& x);
template<class... Args>
constexpr reference emplace_back(Args&&... args);
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11157)
*Returns*: back()[.](#4.sentence-1)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11161)
*Throws*: bad_alloc or
any exception thrown by the initialization of the inserted element[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11166)
*Complexity*: Constant[.](#6.sentence-1)
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11170)
*Remarks*: If an exception is thrown, there are no effects on *this[.](#7.sentence-1)
[🔗](#lib:try_emplace_back,inplace_vector)
`template<class... Args>
constexpr pointer try_emplace_back(Args&&... args);
constexpr pointer try_push_back(const T& x);
constexpr pointer try_push_back(T&& x);
`
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11185)
Let vals denote a pack:
- [(8.1)](#8.1)
std::forward<Args>(args)... for the first overload,
- [(8.2)](#8.2)
x for the second overload,
- [(8.3)](#8.3)
std::move(x) for the third overload[.](#8.sentence-1)
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11193)
*Preconditions*: value_type is *Cpp17EmplaceConstructible* into inplace_vector from vals...[.](#9.sentence-1)
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11198)
*Effects*: If size() < capacity() is true,
appends an object of type T direct-non-list-initialized with vals...[.](#10.sentence-1)
Otherwise, there are no effects[.](#10.sentence-2)
[11](#11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11205)
*Returns*: nullptr if size() == capacity() is true,
otherwise addressof(back())[.](#11.sentence-1)
[12](#12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11210)
*Throws*: Nothing unless an exception is thrown by the initialization of the inserted element[.](#12.sentence-1)
[13](#13)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11214)
*Complexity*: Constant[.](#13.sentence-1)
[14](#14)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11218)
*Remarks*: If an exception is thrown, there are no effects on *this[.](#14.sentence-1)
[🔗](#lib:try_append_range,inplace_vector)
`template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<T> R>
constexpr ranges::borrowed_iterator_t<R> try_append_range(R&& rg);
`
[15](#15)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11230)
*Preconditions*: value_type is *Cpp17EmplaceConstructible* into inplace_vector from
*ranges::begin(rg)[.](#15.sentence-2)
[16](#16)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11235)
*Effects*: Appends copies of initial elements in rg before end(),
until all elements are inserted or size() == capacity() is true[.](#16.sentence-1)
Each iterator in the range rg is dereferenced at most once[.](#16.sentence-2)
[17](#17)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11241)
*Returns*: An iterator pointing to the first element of rg that was not inserted into *this,
or ranges::end(rg) if no such element exists[.](#17.sentence-1)
[18](#18)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11247)
*Complexity*: Linear in the number of elements inserted[.](#18.sentence-1)
[19](#19)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11251)
*Remarks*: Let n be the value of size() prior to this call[.](#19.sentence-1)
If an exception is thrown after the insertion of k elements, thensize() equals n+k,
elements in the range begin() + [0, n) are not modified, and
elements in the range begin() + [n, n+k) correspond to
the inserted elements[.](#19.sentence-2)
[🔗](#lib:unchecked_emplace_back,inplace_vector)
`template<class... Args>
constexpr reference unchecked_emplace_back(Args&&... args);
`
[20](#20)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11268)
*Preconditions*: size() < capacity() is true[.](#20.sentence-1)
[21](#21)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11272)
*Effects*: Equivalent to:return *try_emplace_back(std::forward<Args>(args)...);
[🔗](#lib:unchecked_push_back,inplace_vector)
`constexpr reference unchecked_push_back(const T& x);
constexpr reference unchecked_push_back(T&& x);
`
[22](#22)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11285)
*Preconditions*: size() < capacity() is true[.](#22.sentence-1)
[23](#23)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11289)
*Effects*: Equivalent to:return *try_push_back(std::forward<decltype(x)>(x));
[🔗](#lib:erase,inplace_vector)
`constexpr iterator erase(const_iterator position);
constexpr iterator erase(const_iterator first, const_iterator last);
constexpr void pop_back();
`
[24](#24)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11304)
*Effects*: Invalidates iterators and references at or after the point of the erase[.](#24.sentence-1)
[25](#25)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11308)
*Throws*: Nothing unless an exception is thrown by
the assignment operator or move assignment operator of T[.](#25.sentence-1)
[26](#26)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L11313)
*Complexity*: The destructor of T is called the number of times
equal to the number of the elements erased, but
the assignment operator of T is called the number of times
equal to the number of elements after the erased elements[.](#26.sentence-1)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,13 @@
[inplace.vector.syn]
# 23 Containers library [[containers]](./#containers)
## 23.3 Sequence containers [[sequences]](sequences#inplace.vector.syn)
### 23.3.15 Header <inplace_vector> synopsis [inplace.vector.syn]
[🔗](#header:%3cinplace_vector%3e)
// mostly freestanding#include <compare> // see [[compare.syn]](compare.syn "17.12.1Header <compare> synopsis")#include <initializer_list> // see [[initializer.list.syn]](initializer.list.syn "17.11.2Header <initializer_­list> synopsis")namespace std {// [[inplace.vector]](inplace.vector "23.3.16Class template inplace_­vector"), class template inplace_vectortemplate<class T, size_t N> class inplace_vector; // partially freestanding// [[inplace.vector.erasure]](inplace.vector.erasure "23.3.16.6Erasure"), erasuretemplate<class T, size_t N, class U = T>constexpr typename inplace_vector<T, N>::size_type
erase(inplace_vector<T, N>& c, const U& value); template<class T, size_t N, class Predicate>constexpr typename inplace_vector<T, N>::size_type
erase_if(inplace_vector<T, N>& c, Predicate pred);}