EnumParseOverflowContainer is a class template in the Boost C++ Libraries that provides a container for enumerations that can be automatically generated, extended, and used to parse strings. The class template allows a simple way to parse enum values with a default behavior to handle unknown values.
Example 1: Using EnumParseOverflowContainer to store and parse an enumeration. ```c++ enum class Color { red, green, blue }; using ColorContainer = boost::enum_parse::EnumParseOverflowContainer;
Color c = colorMap.parse("red"); // c is now set to Color::red
Example 2:
Adding additional values to an existing EnumParseOverflowContainer.
c++
enum class Color { red, green, blue };
using ColorContainer = boost::enum_parse::EnumParseOverflowContainer;
ColorContainer colorMap;
colorMap.insert("red", Color::red);
colorMap.insert("green", Color::green);
colorMap.insert("blue", Color::blue);
colorMap.extend("yellow", Color::yellow); // add an additional value to the container
Color c = colorMap.parse("yellow"); // c is now set to Color::yellow
```
Package/Library: Boost C++ Libraries.
C++ (Cpp) EnumParseOverflowContainer - 8 examples found. These are the top rated real world C++ (Cpp) examples of EnumParseOverflowContainer extracted from open source projects. You can rate examples to help us improve the quality of examples.