Simple any class.
More...
#include <any.hpp>
|
| | any ()=default |
| | Default constructor.
|
| |
| | any (any &&s) noexcept |
| | Move copy constructor.
|
| |
| | any (any const &s) |
| | Copy constructor.
|
| |
| template<typename T , typename U = decay<T>, typename = none<U>> |
| | any (T &&x) |
| | Create any from concrete object.
|
| |
| any & | operator= (any s) |
| | Assignment operator.
|
| |
| std::type_index | type_index () const |
| | Get the type index of an any object.
|
| |
| void | clear () |
| | Clear any object.
|
| |
| bool | empty () const |
| | Returns true if no object is assigned to any.
|
| |
| template<typename T > |
| bool | is () const |
| | Checks type of any with given type.
|
| |
| template<typename T > |
| T && | _ () && |
| | Returns the moved any object as static cast.
|
| |
| template<typename T > |
| T & | _ () & |
| | Returns reference to any object as static cast.
|
| |
| template<typename T > |
| T const & | _ () const & |
| | Returns const reference to any object as static cast.
|
| |
| template<typename T > |
| T && | cast () && |
| | Returns the moved any object as dynamic cast.
|
| |
| template<typename T > |
| T & | cast () & |
| | Returns reference to any object as dynamic cast.
|
| |
| template<typename T > |
| T const & | cast () const & |
| | Returns const reference to any object as dynamic cast.
|
| |
| template<typename T > |
| | operator T&& () && |
| | Returns the moved any object as static cast.
|
| |
| template<typename T > |
| | operator T& () & |
| | Returns reference to any object as static cast.
|
| |
| template<typename T > |
| | operator T const & () const & |
| | Returns const reference to any object as static cast.
|
| |
|
| void | swap (any &s, any &r) |
| | Allow swapping of any objects.
|
| |
Simple any class.
Simple any class taken from here. This class is a template-less holder for any type of object.
◆ any() [1/4]
Default constructor.
Create an empty anonymous any
◆ any() [2/4]
| matador::any::any |
( |
any && |
s | ) |
|
|
inlinenoexcept |
Move copy constructor.
- Parameters
-
◆ any() [3/4]
| matador::any::any |
( |
any const & |
s | ) |
|
|
inline |
Copy constructor.
- Parameters
-
◆ any() [4/4]
template<typename T , typename U = decay<T>, typename = none<U>>
| matador::any::any |
( |
T && |
x | ) |
|
|
inline |
Create any from concrete object.
- Template Parameters
-
| T | Type of object |
| U | Decay type of object |
- Parameters
-
◆ _() [1/3]
template<typename T >
| T & matador::any::_ |
( |
| ) |
& |
|
inline |
Returns reference to any object as static cast.
- Template Parameters
-
- Returns
- Reference to any object
◆ _() [2/3]
template<typename T >
| T && matador::any::_ |
( |
| ) |
&& |
|
inline |
Returns the moved any object as static cast.
- Template Parameters
-
- Returns
- The moved any object
◆ _() [3/3]
template<typename T >
| T const & matador::any::_ |
( |
| ) |
const & |
|
inline |
Returns const reference to any object as static cast.
- Template Parameters
-
- Returns
- Const reference to any object
◆ cast() [1/3]
template<typename T >
| T & matador::any::cast |
( |
| ) |
& |
|
inline |
Returns reference to any object as dynamic cast.
- Template Parameters
-
- Returns
- Reference to any object
◆ cast() [2/3]
template<typename T >
| T && matador::any::cast |
( |
| ) |
&& |
|
inline |
Returns the moved any object as dynamic cast.
- Template Parameters
-
- Returns
- The moved any object
◆ cast() [3/3]
template<typename T >
| T const & matador::any::cast |
( |
| ) |
const & |
|
inline |
Returns const reference to any object as dynamic cast.
- Template Parameters
-
- Returns
- Const reference to any object
◆ clear()
| void matador::any::clear |
( |
| ) |
|
|
inline |
Clear any object.
Deletes the internal object
◆ empty()
| bool matador::any::empty |
( |
| ) |
const |
|
inline |
Returns true if no object is assigned to any.
- Returns
- True if no object is assigned to any
◆ is()
template<typename T >
| bool matador::any::is |
( |
| ) |
const |
|
inline |
Checks type of any with given type.
- Template Parameters
-
- Returns
- True if types are the same
◆ operator T const &()
template<typename T >
| matador::any::operator T const & |
( |
| ) |
const & |
|
inline |
Returns const reference to any object as static cast.
- Template Parameters
-
- Returns
- Const reference to any object
◆ operator T&()
template<typename T >
| matador::any::operator T& |
( |
| ) |
& |
|
inline |
Returns reference to any object as static cast.
- Template Parameters
-
- Returns
- Reference to any object
◆ operator T&&()
template<typename T >
| matador::any::operator T&& |
( |
| ) |
&& |
|
inline |
Returns the moved any object as static cast.
- Template Parameters
-
- Returns
- The moved any object
◆ operator=()
| any & matador::any::operator= |
( |
any |
s | ) |
|
|
inline |
Assignment operator.
- Parameters
-
| s | any object to be assigned |
- Returns
- Reference to assigned any
◆ type_index()
| std::type_index matador::any::type_index |
( |
| ) |
const |
|
inline |
Get the type index of an any object.
Get the type index of an any object. If any doesn't hold a value a logic_error is thrown.
- Exceptions
-
- Returns
- The type_index of the underlying type
◆ swap
| void swap |
( |
any & |
s, |
|
|
any & |
r |
|
) |
| |
|
friend |
Allow swapping of any objects.
- Parameters
-
| s | Right hand any to swap |
| r | left hand any to swap |
The documentation for this class was generated from the following file: