template<typename Type, typename Union>
struct SC::TaggedMap< Type, Union >
Map of SC::TaggedUnion, where the key is TaggedUnion enumeration value.
- Template Parameters
-
Type | Enumeration type used |
Union | with FieldTypes = TypeList<TaggedType<EnumType, EnumValue, Type>, ...> |
Example:
namespace SC
{
struct Compile
{
enum Type
{
libraryPath = 10,
enableRTTI = 110,
};
};
struct CompileFlags
{
template <Compile::Type E, typename T>
using Tag = TaggedType<Compile::Type, E, T>;
using FieldsTypes = TypeTraits::TypeList<
Tag<Compile::libraryPath, String>,
Tag<Compile::enableRTTI, bool>>;
using Union = TaggedUnion<CompileFlags>;
};
}
void SC::TaggedMapTest::basic()
{
TaggedMap<Compile::Type, CompileFlags::Union> taggedMap;
*taggedMap.getOrCreate<Compile::libraryPath>() = "My String";
SC_TEST_EXPECT(*taggedMap.get<Compile::libraryPath>() ==
"My String");
*taggedMap.getOrCreate<Compile::enableRTTI>() = true;
}
#define SC_TEST_EXPECT(e)
Records a test expectation (eventually aborting or breaking o n failed test)
Definition: Testing.h:113