namespace inline
literalsConvenience literal operators for working with toml++.
This namespace exists so you can safely hoist the toml++ literal operators into another scope without dragging in everything from the toml namespace:
#include <toml++/toml.h> using namespace toml::literals; int main() { toml::table tbl = "vals = [1, 2, 3]"_toml; // ... do stuff with the table generated by the "_toml" literal ... return 0; }
Functions
-
auto operator""_toml(const char* str,
size_t len) → parse_
result - Parses TOML data from a string literal.
-
auto operator""_toml(const char8_t* str,
size_t len) → parse_
result - Parses TOML data from a UTF-8 string literal.
- auto operator""_tpath(const char* str, size_t len) → path
- Parses a TOML path from a string literal.
Function documentation
parse_ result toml:: literals:: operator""_toml(const char* str,
size_t len)
Parses TOML data from a string literal.
Parameters | |
---|---|
str | The string data. Must be valid UTF-8. |
len | The string length. |
Returns | With exceptions: A toml:: |
using namespace toml::literals; auto tbl = "a = 3"_toml; std::cout << tbl["a"] << "\n";
3
parse_ result toml:: literals:: operator""_toml(const char8_t* str,
size_t len)
Parses TOML data from a UTF-8 string literal.
Parameters | |
---|---|
str | The string data. Must be valid UTF-8. |
len | The string length. |
Returns | With exceptions: A toml:: |
using namespace toml::literals; auto tbl = u8"a = 3"_toml; std::cout << tbl["a"] << "\n";
3
path toml:: literals:: operator""_tpath(const char* str,
size_t len)
Parses a TOML path from a string literal.
Parameters | |
---|---|
str | The string data. |
len | The string length. |
Returns | A toml:: |
using namespace toml::literals; auto path = "main.settings.devices[2]"_tpath; std::cout << path.parent_path() << "\n";
main.settings.devices