Lumiera  0.pre.03
»edit your freedom«
OpaqueHolder_test Class Reference

Description

Test:
use the OpaqueHolder inline buffer to handle objects of a family of types through a common interface, without being forced to use heap storage or a custom allocator.
Todo:
this test doesn't cover automatic conversions and conversions using RTTI from the target objects, while OpaqueHolder.template get() would allow for such conversions. This is similar to Ticket #141, and actually based on the same code as variant.hpp (access-casted.hpp)

Definition at line 120 of file opaque-holder-test.cpp.

Private Member Functions

void checkHandling (TestList &objs)
 
void checkSpecialSubclass ()
 
TestList createDummies ()
 
virtual void run (Arg)
 

Static Private Member Functions

static void reAccess (Opaque &elm)
 

Member Function Documentation

◆ checkHandling()

void checkHandling ( TestList &  objs)
inlineprivate
Test:
cover the basic situations of object handling, especially copy operations and re-assignments

Definition at line 161 of file opaque-holder-test.cpp.

◆ checkSpecialSubclass()

void checkSpecialSubclass ( )
inlineprivate
Test:
OpaqueHolder with additional storage for subclass.

When a subclass requires more storage than the base class or Interface, we need to create a custom OpaqueHolder, specifying the actually necessary storage. Such a custom OpaqueHolder behaves exactly like the standard variant, but there is protection against accidentally using a standard variant to hold an instance of the larger subclass.

Test:
Moreover, if the concrete class has a custom operator bool(), it will be invoked automatically from OpaqueHolder's operator bool()

Definition at line 250 of file opaque-holder-test.cpp.

References lib::test::anonymous_namespace{opaque-holder-test.cpp}::_ALIGN_.

+ Inheritance diagram for OpaqueHolder_test:
+ Collaboration diagram for OpaqueHolder_test:

The documentation for this class was generated from the following file: