@@ -117,6 +117,7 @@ struct sealed_policy {
117117 using observer_policy = default_observer_policy;
118118};
119119
120+ // / Metaprogramming class to query a policy for implementation choices
120121template <typename Policy>
121122struct policy_queries {
122123 // Check for incompatibilities in policy
@@ -128,33 +129,40 @@ struct policy_queries {
128129 using policy = Policy;
129130 using observer_policy = typename Policy::observer_policy;
130131
132+ // / Does @ref basic_enable_observer_from_this use virtual inheritance?
131133 static constexpr bool eoft_base_is_virtual () noexcept {
132134 return Policy::allow_eoft_multiple_inheritance &&
133135 !Policy::eoft_constructor_takes_control_block;
134136 }
135137
138+ // / Does @ref basic_enable_observer_from_this need a control block in its constructor?
136139 static constexpr bool eoft_base_constructor_needs_block () noexcept {
137140 return Policy::eoft_constructor_takes_control_block;
138141 }
139142
143+ // / Does @ref basic_enable_observer_from_this allocate in its constructor?
140144 static constexpr bool eoft_constructor_allocates () noexcept {
141145 return !Policy::is_sealed && Policy::allow_eoft_in_constructor &&
142146 !Policy::eoft_constructor_takes_control_block;
143147 }
144148
149+ // / Does @ref basic_observable_ptr allow releasing and acquiring raw pointers?
145150 static constexpr bool owner_allow_release () noexcept {
146151 return !Policy::is_sealed;
147152 }
148153
154+ // / Does @ref make_observable produce a single allocation?
149155 static constexpr bool make_observer_single_allocation () noexcept {
150156 return Policy::is_sealed;
151157 }
152158};
153159
160+ // / Metaprogramming class to query an observer policy for implementation choices
154161template <typename Policy>
155162struct observer_policy_queries {
156163 using observer_policy = Policy;
157164
165+ // / Storage type for the control block
158166 using control_block_storage_type = typename details::unsigned_least<
159167 1 + details::ceil_log2(observer_policy::max_observers)>::type;
160168};
@@ -225,7 +233,6 @@ class basic_control_block final {
225233};
226234
227235namespace details {
228-
229236 template <typename Policy>
230237 struct enable_observer_from_this_base {
231238 // / Policy for the control block
@@ -362,7 +369,7 @@ class basic_observable_ptr final {
362369 // / Deleter type
363370 using deleter_type = Deleter;
364371
365- protected :
372+ private :
366373 control_block_type* block = nullptr ;
367374 details::ptr_and_deleter<T, Deleter> ptr_deleter;
368375
@@ -1210,7 +1217,7 @@ namespace details {
12101217 };
12111218}
12121219
1213- // / Enables creating an @ref observer_ptr from `this`.
1220+ // / Enables creating a @ref basic_observer_ptr from `this`.
12141221/* * If an object is owned by a @ref basic_observable_ptr and must be able to create an observer
12151222* pointer to itself, without having direct access to the owner pointer,
12161223* then the object's class can inherit from @ref basic_enable_observer_from_this.
0 commit comments