@@ -117,6 +117,7 @@ struct sealed_policy {
117
117
using observer_policy = default_observer_policy;
118
118
};
119
119
120
+ // / Metaprogramming class to query a policy for implementation choices
120
121
template <typename Policy>
121
122
struct policy_queries {
122
123
// Check for incompatibilities in policy
@@ -128,33 +129,40 @@ struct policy_queries {
128
129
using policy = Policy;
129
130
using observer_policy = typename Policy::observer_policy;
130
131
132
+ // / Does @ref basic_enable_observer_from_this use virtual inheritance?
131
133
static constexpr bool eoft_base_is_virtual () noexcept {
132
134
return Policy::allow_eoft_multiple_inheritance &&
133
135
!Policy::eoft_constructor_takes_control_block;
134
136
}
135
137
138
+ // / Does @ref basic_enable_observer_from_this need a control block in its constructor?
136
139
static constexpr bool eoft_base_constructor_needs_block () noexcept {
137
140
return Policy::eoft_constructor_takes_control_block;
138
141
}
139
142
143
+ // / Does @ref basic_enable_observer_from_this allocate in its constructor?
140
144
static constexpr bool eoft_constructor_allocates () noexcept {
141
145
return !Policy::is_sealed && Policy::allow_eoft_in_constructor &&
142
146
!Policy::eoft_constructor_takes_control_block;
143
147
}
144
148
149
+ // / Does @ref basic_observable_ptr allow releasing and acquiring raw pointers?
145
150
static constexpr bool owner_allow_release () noexcept {
146
151
return !Policy::is_sealed;
147
152
}
148
153
154
+ // / Does @ref make_observable produce a single allocation?
149
155
static constexpr bool make_observer_single_allocation () noexcept {
150
156
return Policy::is_sealed;
151
157
}
152
158
};
153
159
160
+ // / Metaprogramming class to query an observer policy for implementation choices
154
161
template <typename Policy>
155
162
struct observer_policy_queries {
156
163
using observer_policy = Policy;
157
164
165
+ // / Storage type for the control block
158
166
using control_block_storage_type = typename details::unsigned_least<
159
167
1 + details::ceil_log2(observer_policy::max_observers)>::type;
160
168
};
@@ -225,7 +233,6 @@ class basic_control_block final {
225
233
};
226
234
227
235
namespace details {
228
-
229
236
template <typename Policy>
230
237
struct enable_observer_from_this_base {
231
238
// / Policy for the control block
@@ -362,7 +369,7 @@ class basic_observable_ptr final {
362
369
// / Deleter type
363
370
using deleter_type = Deleter;
364
371
365
- protected :
372
+ private :
366
373
control_block_type* block = nullptr ;
367
374
details::ptr_and_deleter<T, Deleter> ptr_deleter;
368
375
@@ -1210,7 +1217,7 @@ namespace details {
1210
1217
};
1211
1218
}
1212
1219
1213
- // / Enables creating an @ref observer_ptr from `this`.
1220
+ // / Enables creating a @ref basic_observer_ptr from `this`.
1214
1221
/* * If an object is owned by a @ref basic_observable_ptr and must be able to create an observer
1215
1222
* pointer to itself, without having direct access to the owner pointer,
1216
1223
* then the object's class can inherit from @ref basic_enable_observer_from_this.
0 commit comments