mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-16 00:46:03 +08:00
61 lines
1.5 KiB
Plaintext
61 lines
1.5 KiB
Plaintext
packet
|
|
|
|
A class that can contain one of several related types.
|
|
STL equivalent: none
|
|
|
|
etl::packet<typename TBase, size_t SIZE, size_t ALIGNMENT>
|
|
|
|
TBase The base class for all objects. The destructor must be virtual.
|
|
SIZE The size of the largest type.
|
|
ALIGNMENT The largest alignment of all of the types.
|
|
|
|
____________________________________________________________________________________________________
|
|
Member types
|
|
|
|
base_t TBase
|
|
|
|
____________________________________________________________________________________________________
|
|
Contructor
|
|
|
|
C++03
|
|
template <typename T>
|
|
explicit packet(const T& value)
|
|
|
|
C++11
|
|
template <typename T>
|
|
explicit packet(T&& value)
|
|
|
|
Constructs an object of type T with the supplied value.
|
|
Static asserts on any type that does not derive from TBase.
|
|
Static asserts on any type that does not conform to the maximum size and alignment.
|
|
|
|
____________________________________________________________________________________________________
|
|
Destructor
|
|
|
|
~packet()
|
|
|
|
Destructs the contained object
|
|
|
|
____________________________________________________________________________________________________
|
|
Operator
|
|
|
|
C++03
|
|
template <typename T>
|
|
packet& operator =(const T& value)
|
|
|
|
C++11
|
|
template <typename T>
|
|
packet& operator =(T&& value)
|
|
|
|
Assigns a new object to the packet.
|
|
The previous object is destructed.
|
|
|
|
____________________________________________________________________________________________________
|
|
Access
|
|
|
|
const TBase& get() const
|
|
|
|
Returns a const reference to the contained object.
|
|
|
|
|