Home | Libraries | People | FAQ | More |
Values are strongly informational objects for which identity is not significant, i.e. the focus is principally on their state content and any behavior organized around that. Another distinguishing feature of values is their granularity: normally fine-grained objects representing simple concepts in the system such as quantities.
As the emphasis of a value lies in its state not its identity, values can be copied and typically assigned one to another, requiring the explicit or implicit definition of a public copy constructor and public assignment operator. Values typically live within other scopes, i.e. within objects or blocks, rather than on the heap. Values are therefore normally passed around and manipulated directly as variables or through references, but not as pointers that emphasize identity and indirection.
The specific requirements on value types to be used in an
any
are:
namespace boost { class bad_any_cast; class any; void swap(any &, any &); template<typename T> T any_cast(any &); template<typename T> T any_cast(any &&); template<typename T> T any_cast(const any &); template<typename ValueType> const ValueType * any_cast(const any *); template<typename ValueType> ValueType * any_cast(any *); }