EnTT 3.14.0
|
Static polymorphism made simple and within everyone's reach. More...
#include <poly.hpp>
Public Types | |
using | concept_type = typename Concept::template type<poly_base<basic_poly>> |
Concept type. | |
using | vtable_type = typename poly_vtable<Concept, Len, Align>::type |
Virtual table type. | |
Public Member Functions | |
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. | |
Friends | |
struct | poly_base< basic_poly > |
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.
poly
class template also works with unmanaged objects.Concept | Concept descriptor. |
Len | Size of the storage reserved for the small buffer optimization. |
Align | Optional alignment requirement. |
using entt::basic_poly< Concept, Len, Align >::concept_type = typename Concept::template type<poly_base<basic_poly>> |
using entt::basic_poly< Concept, Len, Align >::vtable_type = typename poly_vtable<Concept, Len, Align>::type |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineexplicitnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
friend |