From Jason Turner

[allocator.adaptor.syn]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpfv_57r_u/{from.md → to.md} +27 -17
tmp/tmpfv_57r_u/{from.md → to.md} RENAMED
@@ -27,41 +27,44 @@ allocator is the outer allocator for use by the container, the second
27
  allocator is passed to the constructors of the container’s elements,
28
  and, if the elements themselves are containers, the third allocator is
29
  passed to the elements’ elements, and so on. If containers are nested to
30
  a depth greater than the number of allocators, the last allocator is
31
  used repeatedly, as in the single-allocator case, for any remaining
32
- recursions. The `scoped_allocator_adaptor` is derived from the outer
 
 
33
  allocator type so it can be substituted for the outer allocator type in
34
- most expressions.
35
 
36
  ``` cpp
37
  namespace std {
38
  template <class OuterAlloc, class... InnerAllocs>
39
  class scoped_allocator_adaptor : public OuterAlloc {
40
  private:
41
- typedef allocator_traits<OuterAlloc> OuterTraits; // exposition only
42
  scoped_allocator_adaptor<InnerAllocs...> inner; // exposition only
43
  public:
44
- typedef OuterAlloc outer_allocator_type;
45
- typedef see below inner_allocator_type;
46
 
47
- typedef typename OuterTraits::value_type value_type;
48
- typedef typename OuterTraits::size_type size_type;
49
- typedef typename OuterTraits::difference_type difference_type;
50
- typedef typename OuterTraits::pointer pointer;
51
- typedef typename OuterTraits::const_pointer const_pointer;
52
- typedef typename OuterTraits::void_pointer void_pointer;
53
- typedef typename OuterTraits::const_void_pointer const_void_pointer;
54
 
55
- typedef see below propagate_on_container_copy_assignment;
56
- typedef see below propagate_on_container_move_assignment;
57
- typedef see below propagate_on_container_swap;
 
58
 
59
  template <class Tp>
60
  struct rebind {
61
- typedef scoped_allocator_adaptor<
62
- OuterTraits::template rebind_alloc<Tp>, InnerAllocs...> other;
63
  };
64
 
65
  scoped_allocator_adaptor();
66
  template <class OuterA2>
67
  scoped_allocator_adaptor(OuterA2&& outerAlloc,
@@ -75,10 +78,13 @@ namespace std {
75
  const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other) noexcept;
76
  template <class OuterA2>
77
  scoped_allocator_adaptor(
78
  scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other) noexcept;
79
 
 
 
 
80
  ~scoped_allocator_adaptor();
81
 
82
  inner_allocator_type& inner_allocator() noexcept;
83
  const inner_allocator_type& inner_allocator() const noexcept;
84
  outer_allocator_type& outer_allocator() noexcept;
@@ -107,10 +113,14 @@ namespace std {
107
  void destroy(T* p);
108
 
109
  scoped_allocator_adaptor select_on_container_copy_construction() const;
110
  };
111
 
 
 
 
 
112
  template <class OuterA1, class OuterA2, class... InnerAllocs>
113
  bool operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
114
  const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
115
  template <class OuterA1, class OuterA2, class... InnerAllocs>
116
  bool operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
 
27
  allocator is passed to the constructors of the container’s elements,
28
  and, if the elements themselves are containers, the third allocator is
29
  passed to the elements’ elements, and so on. If containers are nested to
30
  a depth greater than the number of allocators, the last allocator is
31
  used repeatedly, as in the single-allocator case, for any remaining
32
+ recursions.
33
+
34
+ [*Note 1*: The `scoped_allocator_adaptor` is derived from the outer
35
  allocator type so it can be substituted for the outer allocator type in
36
+ most expressions. — *end note*]
37
 
38
  ``` cpp
39
  namespace std {
40
  template <class OuterAlloc, class... InnerAllocs>
41
  class scoped_allocator_adaptor : public OuterAlloc {
42
  private:
43
+ using OuterTraits = allocator_traits<OuterAlloc>; // exposition only
44
  scoped_allocator_adaptor<InnerAllocs...> inner; // exposition only
45
  public:
46
+ using outer_allocator_type = OuterAlloc;
47
+ using inner_allocator_type = see below;
48
 
49
+ using value_type = typename OuterTraits::value_type;
50
+ using size_type = typename OuterTraits::size_type;
51
+ using difference_type = typename OuterTraits::difference_type;
52
+ using pointer = typename OuterTraits::pointer;
53
+ using const_pointer = typename OuterTraits::const_pointer;
54
+ using void_pointer = typename OuterTraits::void_pointer;
55
+ using const_void_pointer = typename OuterTraits::const_void_pointer;
56
 
57
+ using propagate_on_container_copy_assignment = see below;
58
+ using propagate_on_container_move_assignment = see below;
59
+ using propagate_on_container_swap = see below;
60
+ using is_always_equal = see below;
61
 
62
  template <class Tp>
63
  struct rebind {
64
+ using other = scoped_allocator_adaptor<
65
+ OuterTraits::template rebind_alloc<Tp>, InnerAllocs...>;
66
  };
67
 
68
  scoped_allocator_adaptor();
69
  template <class OuterA2>
70
  scoped_allocator_adaptor(OuterA2&& outerAlloc,
 
78
  const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other) noexcept;
79
  template <class OuterA2>
80
  scoped_allocator_adaptor(
81
  scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other) noexcept;
82
 
83
+ scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default;
84
+ scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default;
85
+
86
  ~scoped_allocator_adaptor();
87
 
88
  inner_allocator_type& inner_allocator() noexcept;
89
  const inner_allocator_type& inner_allocator() const noexcept;
90
  outer_allocator_type& outer_allocator() noexcept;
 
113
  void destroy(T* p);
114
 
115
  scoped_allocator_adaptor select_on_container_copy_construction() const;
116
  };
117
 
118
+ template<class OuterAlloc, class... InnerAllocs>
119
+ scoped_allocator_adaptor(OuterAlloc, InnerAllocs...)
120
+ -> scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>;
121
+
122
  template <class OuterA1, class OuterA2, class... InnerAllocs>
123
  bool operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
124
  const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
125
  template <class OuterA1, class OuterA2, class... InnerAllocs>
126
  bool operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,