|
| basic_poly () noexcept=default |
| Default constructor.
|
|
template<typename Type, typename... Args> |
| basic_poly (std::in_place_type_t< Type >, Args &&...args) |
| Constructs a poly by directly initializing the new object.
|
|
template<typename Type, typename = std::enable_if_t<!std::is_same_v<std::remove_cv_t<std::remove_reference_t<Type>>, basic_poly>>> |
| basic_poly (Type &&value) noexcept |
| Constructs a poly from a given value.
|
|
const type_info & | type () const noexcept |
| Returns the object type if any, type_id<void>() otherwise.
|
|
const void * | data () const noexcept |
| Returns an opaque pointer to the contained instance.
|
|
void * | data () noexcept |
| Returns an opaque pointer to the contained instance.
|
|
template<typename Type, typename... Args> |
void | emplace (Args &&...args) |
| Replaces the contained object by creating a new instance directly.
|
|
void | reset () |
| Destroys contained object.
|
|
| operator bool () const noexcept |
| Returns false if a poly is empty, true otherwise.
|
|
concept_type * | operator-> () noexcept |
| Returns a pointer to the underlying concept.
|
|
const concept_type * | operator-> () const noexcept |
| Returns a pointer to the underlying concept.
|
|
basic_poly | as_ref () noexcept |
| Aliasing constructor.
|
|
basic_poly | as_ref () const noexcept |
| Aliasing constructor.
|
|
template<typename Concept, std::size_t Len, std::size_t Align>
class entt::basic_poly< Concept, Len, Align >
Static polymorphism made simple and within everyone's reach.
Static polymorphism is a very powerful tool in C++, albeit sometimes cumbersome to obtain.
This class aims to make it simple and easy to use.
- Note
- Both deduced and defined static virtual tables are supported.
Moreover, the poly
class template also works with unmanaged objects.
- Template Parameters
-
Concept | Concept descriptor. |
Len | Size of the storage reserved for the small buffer optimization. |
Align | Optional alignment requirement. |
Definition at line 193 of file poly.hpp.
template<typename Concept, std::size_t Len, std::size_t Align>
template<typename Type, typename... Args>
entt::basic_poly< Concept, Len, Align >::basic_poly |
( |
std::in_place_type_t< Type > | , |
|
|
Args &&... | args ) |
|
inlineexplicit |
Constructs a poly by directly initializing the new object.
- Template Parameters
-
Type | Type of object to use to initialize the poly. |
Args | Types of arguments to use to construct the new instance. |
- Parameters
-
args | Parameters to use to construct the instance. |
Definition at line 212 of file poly.hpp.
template<typename Concept, std::size_t Len, std::size_t Align>
template<typename Type, typename = std::enable_if_t<!std::is_same_v<std::remove_cv_t<std::remove_reference_t<Type>>, basic_poly>>>
Constructs a poly from a given value.
- Template Parameters
-
Type | Type of object to use to initialize the poly. |
- Parameters
-
value | An instance of an object to use to initialize the poly. |
Definition at line 222 of file poly.hpp.
template<typename Concept, std::size_t Len, std::size_t Align>
template<typename Type, typename... Args>
Replaces the contained object by creating a new instance directly.
- Template Parameters
-
Type | Type of object to use to initialize the poly. |
Args | Types of arguments to use to construct the new instance. |
- Parameters
-
args | Parameters to use to construct the instance. |
Definition at line 253 of file poly.hpp.