|
|
@ -182,7 +182,7 @@ ValueType* any_cast(any* operand) noexcept; |
|
|
|
// object, when containing a value, must contain a value type; storing a
|
|
|
|
// object, when containing a value, must contain a value type; storing a
|
|
|
|
// reference type is neither desired nor supported.
|
|
|
|
// reference type is neither desired nor supported.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// An `absl::any` can only store a type that is copy-constructable; move-only
|
|
|
|
// An `absl::any` can only store a type that is copy-constructible; move-only
|
|
|
|
// types are not allowed within an `any` object.
|
|
|
|
// types are not allowed within an `any` object.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Example:
|
|
|
|
// Example:
|
|
|
@ -190,7 +190,7 @@ ValueType* any_cast(any* operand) noexcept; |
|
|
|
// auto a = absl::any(65); // Literal, copyable
|
|
|
|
// auto a = absl::any(65); // Literal, copyable
|
|
|
|
// auto b = absl::any(std::vector<int>()); // Default-initialized, copyable
|
|
|
|
// auto b = absl::any(std::vector<int>()); // Default-initialized, copyable
|
|
|
|
// std::unique_ptr<Foo> my_foo;
|
|
|
|
// std::unique_ptr<Foo> my_foo;
|
|
|
|
// auto c = absl::any(std::move(my_foo)); // Error, not copy-constructable
|
|
|
|
// auto c = absl::any(std::move(my_foo)); // Error, not copy-constructible
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Note that `absl::any` makes use of decayed types (`absl::decay_t` in this
|
|
|
|
// Note that `absl::any` makes use of decayed types (`absl::decay_t` in this
|
|
|
|
// context) to remove const-volatile qualifiers (known as "cv qualifiers"),
|
|
|
|
// context) to remove const-volatile qualifiers (known as "cv qualifiers"),
|
|
|
|