@@ -117,8 +117,8 @@ class basic_any {
117117 if constexpr (!std::is_void_v<Type>) {
118118 using plain_type = std::remove_cv_t <std::remove_reference_t <Type>>;
119119
120- info = &type_id<plain_type>();
121120 vtable = basic_vtable<plain_type>;
121+ descriptor = &type_id<plain_type>();
122122
123123 if constexpr (std::is_lvalue_reference_v<Type>) {
124124 static_assert ((std::is_lvalue_reference_v<Args> && ...) && (sizeof ...(Args) == 1u ), " Invalid arguments" );
@@ -151,8 +151,8 @@ class basic_any {
151151
152152 basic_any (const basic_any &other, const any_policy pol) noexcept
153153 : instance{other.data ()},
154- info{other.info },
155154 vtable{other.vtable },
155+ descriptor{other.descriptor },
156156 mode{pol} {}
157157
158158public:
@@ -219,8 +219,8 @@ class basic_any {
219219 */
220220 basic_any (basic_any &&other) noexcept
221221 : instance{},
222- info{other.info },
223222 vtable{other.vtable },
223+ descriptor{other.descriptor },
224224 mode{other.mode } {
225225 if (other.mode == any_policy::embedded) {
226226 other.vtable (request::move, other, this );
@@ -271,8 +271,8 @@ class basic_any {
271271 instance = std::exchange (other.instance , nullptr );
272272 }
273273
274- info = other.info ;
275274 vtable = other.vtable ;
275+ descriptor = other.descriptor ;
276276 mode = other.mode ;
277277
278278 return *this ;
@@ -291,11 +291,16 @@ class basic_any {
291291 }
292292
293293 /* *
294- * @brief Returns the object type if any, `type_id<void>()` otherwise.
295- * @return The object type if any, `type_id<void>()` otherwise.
294+ * @brief Returns the object type info if any, `type_id<void>()` otherwise.
295+ * @return The object type info if any, `type_id<void>()` otherwise.
296296 */
297- [[nodiscard]] const type_info &type () const noexcept {
298- return (info == nullptr ) ? type_id<void >() : *info;
297+ [[nodiscard]] const type_info &info () const noexcept {
298+ return (descriptor == nullptr ) ? type_id<void >() : *descriptor;
299+ }
300+
301+ /* ! @copydoc info */
302+ [[deprecated(" use ::info instead" )]] [[nodiscard]] const type_info &type () const noexcept {
303+ return info ();
299304 }
300305
301306 /* *
@@ -312,7 +317,7 @@ class basic_any {
312317 * @return An opaque pointer the contained instance, if any.
313318 */
314319 [[nodiscard]] const void *data (const type_info &req) const noexcept {
315- return (type () == req) ? data () : nullptr ;
320+ return (info () == req) ? data () : nullptr ;
316321 }
317322
318323 /* *
@@ -350,7 +355,7 @@ class basic_any {
350355 * @return True in case of success, false otherwise.
351356 */
352357 bool assign (const basic_any &other) {
353- if (vtable && mode != any_policy::cref && *info == other.type ()) {
358+ if (vtable && mode != any_policy::cref && *descriptor == other.info ()) {
354359 return (vtable (request::assign, *this , other.data ()) != nullptr );
355360 }
356361
@@ -360,7 +365,7 @@ class basic_any {
360365 /* ! @copydoc assign */
361366 // NOLINTNEXTLINE(cppcoreguidelines-rvalue-reference-param-not-moved)
362367 bool assign (basic_any &&other) {
363- if (vtable && mode != any_policy::cref && *info == other.type ()) {
368+ if (vtable && mode != any_policy::cref && *descriptor == other.info ()) {
364369 if (auto *val = other.data (); val) {
365370 return (vtable (request::transfer, *this , val) != nullptr );
366371 }
@@ -378,8 +383,8 @@ class basic_any {
378383 }
379384
380385 instance = nullptr ;
381- info = nullptr ;
382386 vtable = nullptr ;
387+ descriptor = nullptr ;
383388 mode = any_policy::empty;
384389 }
385390
@@ -397,7 +402,7 @@ class basic_any {
397402 * @return False if the two objects differ in their content, true otherwise.
398403 */
399404 [[nodiscard]] bool operator ==(const basic_any &other) const noexcept {
400- if (vtable && *info == other.type ()) {
405+ if (vtable && *descriptor == other.info ()) {
401406 return (vtable (request::compare, *this , other.data ()) != nullptr );
402407 }
403408
@@ -447,8 +452,8 @@ class basic_any {
447452 const void *instance;
448453 storage_type storage;
449454 };
450- const type_info *info{};
451455 vtable_type *vtable{};
456+ const type_info *descriptor{};
452457 any_policy mode{any_policy::empty};
453458};
454459
0 commit comments