From Jason Turner

[vector.cons]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpy7xzs0ly/{from.md → to.md} +16 -9
tmp/tmpy7xzs0ly/{from.md → to.md} RENAMED
@@ -10,11 +10,11 @@ constexpr explicit vector(const Allocator&) noexcept;
10
 
11
  ``` cpp
12
  constexpr explicit vector(size_type n, const Allocator& = Allocator());
13
  ```
14
 
15
- *Preconditions:* `T` is *Cpp17DefaultInsertable* into `*this`.
16
 
17
  *Effects:* Constructs a `vector` with `n` default-inserted elements
18
  using the specified allocator.
19
 
20
  *Complexity:* Linear in `n`.
@@ -22,11 +22,11 @@ using the specified allocator.
22
  ``` cpp
23
  constexpr vector(size_type n, const T& value,
24
  const Allocator& = Allocator());
25
  ```
26
 
27
- *Preconditions:* `T` is *Cpp17CopyInsertable* into `*this`.
28
 
29
  *Effects:* Constructs a `vector` with `n` copies of `value`, using the
30
  specified allocator.
31
 
32
  *Complexity:* Linear in `n`.
@@ -40,13 +40,13 @@ template<class InputIterator>
40
  *Effects:* Constructs a `vector` equal to the range \[`first`, `last`),
41
  using the specified allocator.
42
 
43
  *Complexity:* Makes only N calls to the copy constructor of `T` (where N
44
  is the distance between `first` and `last`) and no reallocations if
45
- iterators `first` and `last` are of forward, bidirectional, or random
46
- access categories. It makes order N calls to the copy constructor of `T`
47
- and order log N reallocations if they are just input iterators.
48
 
49
  ``` cpp
50
  template<container-compatible-range<T> R>
51
  constexpr vector(from_range_t, R&& rg, const Allocator& = Allocator());
52
  ```
@@ -54,10 +54,17 @@ template<container-compatible-range<T> R>
54
  *Effects:* Constructs a `vector` object with the elements of the range
55
  `rg`, using the specified allocator.
56
 
57
  *Complexity:* Initializes exactly N elements from the results of
58
  dereferencing successive iterators of `rg`, where N is
59
- `ranges::distance(rg)`. Performs no reallocations if `R` models
60
- `ranges::forward_range` or `ranges::sized_range`; otherwise, performs
61
- order log N reallocations and order N calls to the copy or move
62
- constructor of `T`.
 
 
 
 
 
 
 
63
 
 
10
 
11
  ``` cpp
12
  constexpr explicit vector(size_type n, const Allocator& = Allocator());
13
  ```
14
 
15
+ *Preconditions:* `T` is *Cpp17DefaultInsertable* into `vector`.
16
 
17
  *Effects:* Constructs a `vector` with `n` default-inserted elements
18
  using the specified allocator.
19
 
20
  *Complexity:* Linear in `n`.
 
22
  ``` cpp
23
  constexpr vector(size_type n, const T& value,
24
  const Allocator& = Allocator());
25
  ```
26
 
27
+ *Preconditions:* `T` is *Cpp17CopyInsertable* into `vector`.
28
 
29
  *Effects:* Constructs a `vector` with `n` copies of `value`, using the
30
  specified allocator.
31
 
32
  *Complexity:* Linear in `n`.
 
40
  *Effects:* Constructs a `vector` equal to the range \[`first`, `last`),
41
  using the specified allocator.
42
 
43
  *Complexity:* Makes only N calls to the copy constructor of `T` (where N
44
  is the distance between `first` and `last`) and no reallocations if
45
+ `InputIterator` meets the *Cpp17ForwardIterator* requirements. It makes
46
+ order N calls to the copy constructor of `T` and order log N
47
+ reallocations if they are just input iterators.
48
 
49
  ``` cpp
50
  template<container-compatible-range<T> R>
51
  constexpr vector(from_range_t, R&& rg, const Allocator& = Allocator());
52
  ```
 
54
  *Effects:* Constructs a `vector` object with the elements of the range
55
  `rg`, using the specified allocator.
56
 
57
  *Complexity:* Initializes exactly N elements from the results of
58
  dereferencing successive iterators of `rg`, where N is
59
+ `ranges::distance(rg)`.
60
+
61
+ Performs no reallocations if:
62
+
63
+ - `R` models `ranges::approximately_sized_range`, and
64
+ `ranges::distance(rg) <= ranges::reserve_hint(rg)` is `true`, or
65
+ - `R` models `ranges::forward_range` and `R` does not model
66
+ `ranges::approximately_sized_range`.
67
+
68
+ Otherwise, performs order log N reallocations and order N calls to the
69
+ copy or move constructor of `T`.
70