@@ -19,16 +19,48 @@ class virtual_any;
1919template <class Any , class Registry = BOOST_OPENMETHOD_DEFAULT_REGISTRY >
2020class virtual_any_ref ;
2121
22- namespace detail {
22+ BOOST_OPENMETHOD_OPEN_NAMESPACE_DETAIL_UNLESS_MRDOCS
2323
24+ // ! Test if argument is a wide `any` (exposition only)
25+ // !
26+ // ! Evaluates to `true` if `T` is a specialization of @ref virtual_any or of
27+ // ! @ref virtual_any_ref, and `false` otherwise.
28+ // !
29+ // ! This constrains the constructor and the assignment operator of
30+ // ! @ref virtual_any that take a value, excluding both wide types - every
31+ // ! specialization of them, not only the ones matching this `virtual_any`. A
32+ // ! @ref virtual_any argument then selects the copy or move operation instead
33+ // ! of being stored inside the `any`, and a @ref virtual_any_ref argument is
34+ // ! rejected outright rather than stored: a handle is not a registered class,
35+ // ! so its @ref registry::static_vptr would be null.
36+ // !
37+ // ! @tparam T A type.
2438template <typename T>
25- struct is_virtual_any_aux : std::false_type {} ;
39+ constexpr bool IsVirtualAny = false ;
2640
41+ // ! Recognize a virtual_any (exposition only)
42+ // !
43+ // ! The specialization of @ref IsVirtualAny that matches a
44+ // ! `virtual_any`, and evaluates to `true`.
45+ // !
46+ // ! @tparam Any An `any` type.
47+ // ! @tparam Registry A @ref registry.
2748template <class Any , class Registry >
28- struct is_virtual_any_aux <virtual_any<Any, Registry>> : std::true_type {} ;
49+ constexpr bool IsVirtualAny <virtual_any<Any, Registry>> = true ;
2950
51+ // ! Recognize a virtual_any_ref (exposition only)
52+ // !
53+ // ! The specialization of @ref IsVirtualAny that matches a
54+ // ! `virtual_any_ref`, and evaluates to `true`.
55+ // !
56+ // ! @tparam Any An `any` type, possibly const-qualified.
57+ // ! @tparam Registry A @ref registry.
3058template <class Any , class Registry >
31- struct is_virtual_any_aux <virtual_any_ref<Any, Registry>> : std::true_type {};
59+ constexpr bool IsVirtualAny<virtual_any_ref<Any, Registry>> = true ;
60+
61+ BOOST_OPENMETHOD_CLOSE_NAMESPACE_DETAIL_UNLESS_MRDOCS
62+
63+ namespace detail {
3264
3365// Common implementation for the use_*_any_types registrars: register Root
3466// as a class, and each element of the Classes list as a class derived
@@ -139,7 +171,8 @@ class virtual_any {
139171 template <
140172 typename T,
141173 typename = std::enable_if_t <
142- !detail::is_virtual_any_aux<std::decay_t <T>>::value &&
174+ !BOOST_OPENMETHOD_DETAIL_UNLESS_MRDOCS
175+ IsVirtualAny<std::decay_t <T>> &&
143176 !std::is_same_v<std::decay_t <T>, Any> &&
144177 std::is_constructible_v<Any, T&&>>>
145178 virtual_any (T&& value)
@@ -214,7 +247,8 @@ class virtual_any {
214247 template <
215248 typename T,
216249 typename = std::enable_if_t <
217- !detail::is_virtual_any_aux<std::decay_t <T>>::value &&
250+ !BOOST_OPENMETHOD_DETAIL_UNLESS_MRDOCS
251+ IsVirtualAny<std::decay_t <T>> &&
218252 !std::is_same_v<std::decay_t <T>, Any> &&
219253 std::is_constructible_v<Any, T&&>>>
220254 auto operator =(T&& value) -> virtual_any& {
0 commit comments