File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,27 @@ Bringing the power and flexibility of dynamic typing to modern C++, allowing you
4343 Assert(value.is<std::string>());
4444 Assert(value.is_convertable_to<int>());
4545
46+ * ** Flexible Container Types** - Including dynamic arrays with tuple-like functionality
47+
48+ // Modern C++17 version with direct values
49+ #if __cplusplus >= 201703L
50+ xarray modern = xarray::of(42, "Direct values", 3.14, true);
51+ Assert(modern[0].get_as<int>() == 42);
52+ #endif
53+
54+ // Create a heterogeneous collection (like a tuple)
55+ xarray values = xarray::of(
56+ xnode::value_of(42), // int
57+ xnode::value_of("Hello World"), // string
58+ xnode::value_of(3.14), // double
59+ xnode::value_of(true) // bool
60+ );
61+
62+ // Access elements type-safely
63+ int first = values[0].get_as<int>(); // 42
64+ std::string second = values[1].get_as<std::string>(); // "Hello World"
65+
66+
4667* ** Elegant Named Parameters** - Cleaner than builder pattern, more flexible than structs
4768
4869 std::string printInFont(const xnode &font, const std::string &text) {
You can’t perform that action at this time.
0 commit comments