From Jason Turner

[polymorphic.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwdhkvtzl/{from.md → to.md} +48 -0
tmp/tmpwdhkvtzl/{from.md → to.md} RENAMED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### General <a id="polymorphic.general">[[polymorphic.general]]</a>
2
+
3
+ A polymorphic object manages the lifetime of an owned object. A
4
+ polymorphic object may own objects of different types at different
5
+ points in its lifetime. A polymorphic object is *valueless* if it has no
6
+ owned object. A polymorphic object may become valueless only after it
7
+ has been moved from.
8
+
9
+ In every specialization `polymorphic<T, Allocator>`, if the type
10
+ `allocator_traits<Allocator>::value_type` is not the same type as `T`,
11
+ the program is ill-formed. Every object of type
12
+ `polymorphic<T, Allocator>` uses an object of type `Allocator` to
13
+ allocate and free storage for the owned object as needed.
14
+
15
+ Constructing an owned object of type `U` with `args...` using the
16
+ allocator `a` means calling
17
+ `allocator_traits<Allocator>::construct(a, p, args...)` where `args` is
18
+ an expression pack, `a` is an allocator, and *`p`* points to storage
19
+ suitable for an owned object of type `U`.
20
+
21
+ The member *`alloc`* is used for any memory allocation and element
22
+ construction performed by member functions during the lifetime of each
23
+ polymorphic value object, or until the allocator is replaced. The
24
+ allocator may be replaced only via assignment or `swap()`. `Allocator`
25
+ replacement is performed by copy assignment, move assignment, or
26
+ swapping of the allocator only if [[container.reqmts]]:
27
+
28
+ - `allocator_traits<Allocator>::propagate_on_container_copy_assignment::value`,
29
+ or
30
+ - `allocator_traits<Allocator>::propagate_on_container_move_assignment::value`,
31
+ or
32
+ - `allocator_traits<Allocator>::propagate_on_container_swap::value`
33
+
34
+ is `true` within the implementation of the corresponding `polymorphic`
35
+ operation.
36
+
37
+ A program that instantiates the definition of `polymorphic` for a
38
+ non-object type, an array type, `in_place_t`, a specialization of
39
+ `in_place_type_t`, or a cv-qualified type is ill-formed.
40
+
41
+ The template parameter `T` of `polymorphic` may be an incomplete type.
42
+
43
+ The template parameter `Allocator` of `polymorphic` shall meet the
44
+ requirements of *Cpp17Allocator*.
45
+
46
+ If a program declares an explicit or partial specialization of
47
+ `polymorphic`, the behavior is undefined.
48
+