No version for distro humble showing github. Known supported distros are highlighted in the buttons above.
Repo symbol

yaml_cpp_struct repository

yaml_cpp_struct

ROS Distro
github

Repository Summary

Description
Checkout URI https://github.com/fantasy-peak/yaml_cpp_struct.git
VCS Type git
VCS Version main
Last Updated 2026-11-25
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
yaml_cpp_struct 0.0.1

README

yaml_cpp_struct

function

It’s a header-only wrapper. It’s easy to map YAML documents to C++ structs.

  • (De)serialization for structs, enums, std::optional, std::variant, std::tuple, std::chrono::duration, std::vector, std::list, std::deque, std::forward_list, std::array, std::map, std::unordered_map, std::set, std::unordered_set (including custom comparators/hashers), std::filesystem::path, …
  • std::string_view fields are rejected at compile time because the view would dangle; use std::string instead.
  • Fields are required by default. YCS_OPT(field, default) declares an explicit default for a field that may be missing.
  • Registration either outside the struct with YCS_ADD_STRUCT(T, ...) or inside it with YCS_DEFINE(...); both accept the same annotations.
  • Structured errors with field path, line and column, plus a Result<T> API.
  • Node / stream / multi-document APIs (from_node, from_yaml_stream, to_node, from_yaml_all, from_yaml_all_str).
  • Automatic environment variable loading with per-struct prefixes, nested fields, explicit bindings and YAML value parsing.
  • Optional YAML to JSON conversion with OPEN_YAML_TO_JSON.

note

main branch need >= c++17, if you need to use c++11, please use cpp11 branch. cpp11 branch not support std::variant. Please refer to example for cpp11 branch

The example builds against yaml-cpp 0.9.0 and magic_enum; yaml-cpp >= 0.7 should also work.

use examples

// It relies on two other three open source libraries(yaml-cpp, magic_enum), Please refer to CMakeLists.txt of example
git clone https://github.com/fantasy-peak/yaml_cpp_struct.git
cd ./yaml_cpp_struct/example
mkdir build && cd build
cmake ..
make -j 9
./example ../config.yaml
// use xmake
cd ./yaml_cpp_struct/example
xmake build -v
xmake run example ../config.yaml

Example

---
flag: false
name: "fantasy-peak"
address: { "127.0.0.1": 8888, "127.0.0.2": 9999 }
msec: 100
tuple: ["fantasy-peak", 89]
map_tuple: {"fantasy-peak": ["map_tuple", 254]}
ips: ["127.0.0.1"]

```cpp #include

#include

struct AccountInfo { bool flag; std::string name; std::unordered_map<std::string, int> address; std::optional<std::string> num; std::chrono::milliseconds msec; std::tuple<std::string, uint8_t> tuple; std::unordered_map<std::string, std::tuple<std::string, int32_t» map_tuple; std::string default_str; std::vector<std::string> ips; };

// Bare fields are required. YCS_OPT(field, default) is used when the key is // missing. std::optional fields must be declared explicitly. YCS_ADD_STRUCT(AccountInfo, flag, name, address, YCS_OPT(num, std::nullopt), msec, tuple, map_tuple, YCS_OPT(default_str, “hello default”), ips)

// Optional: read APP_* environment variables automatically in from_yaml(). YCS_ENV_PREFIX(AccountInfo, “APP_”)

int main(int, char** argv) { auto cfg_result = yaml_cpp_struct::from_yaml(argv[1]); if (!cfg_result) { std::cerr << yaml_cpp_struct::format_error(cfg_result.error) << '\n'; return 1;

File truncated at 100 lines see the full file

No version for distro jazzy showing github. Known supported distros are highlighted in the buttons above.
Repo symbol

yaml_cpp_struct repository

yaml_cpp_struct

ROS Distro
github

Repository Summary

Description
Checkout URI https://github.com/fantasy-peak/yaml_cpp_struct.git
VCS Type git
VCS Version main
Last Updated 2026-11-25
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
yaml_cpp_struct 0.0.1

README

yaml_cpp_struct

function

It’s a header-only wrapper. It’s easy to map YAML documents to C++ structs.

  • (De)serialization for structs, enums, std::optional, std::variant, std::tuple, std::chrono::duration, std::vector, std::list, std::deque, std::forward_list, std::array, std::map, std::unordered_map, std::set, std::unordered_set (including custom comparators/hashers), std::filesystem::path, …
  • std::string_view fields are rejected at compile time because the view would dangle; use std::string instead.
  • Fields are required by default. YCS_OPT(field, default) declares an explicit default for a field that may be missing.
  • Registration either outside the struct with YCS_ADD_STRUCT(T, ...) or inside it with YCS_DEFINE(...); both accept the same annotations.
  • Structured errors with field path, line and column, plus a Result<T> API.
  • Node / stream / multi-document APIs (from_node, from_yaml_stream, to_node, from_yaml_all, from_yaml_all_str).
  • Automatic environment variable loading with per-struct prefixes, nested fields, explicit bindings and YAML value parsing.
  • Optional YAML to JSON conversion with OPEN_YAML_TO_JSON.

note

main branch need >= c++17, if you need to use c++11, please use cpp11 branch. cpp11 branch not support std::variant. Please refer to example for cpp11 branch

The example builds against yaml-cpp 0.9.0 and magic_enum; yaml-cpp >= 0.7 should also work.

use examples

// It relies on two other three open source libraries(yaml-cpp, magic_enum), Please refer to CMakeLists.txt of example
git clone https://github.com/fantasy-peak/yaml_cpp_struct.git
cd ./yaml_cpp_struct/example
mkdir build && cd build
cmake ..
make -j 9
./example ../config.yaml
// use xmake
cd ./yaml_cpp_struct/example
xmake build -v
xmake run example ../config.yaml

Example

---
flag: false
name: "fantasy-peak"
address: { "127.0.0.1": 8888, "127.0.0.2": 9999 }
msec: 100
tuple: ["fantasy-peak", 89]
map_tuple: {"fantasy-peak": ["map_tuple", 254]}
ips: ["127.0.0.1"]

```cpp #include

#include

struct AccountInfo { bool flag; std::string name; std::unordered_map<std::string, int> address; std::optional<std::string> num; std::chrono::milliseconds msec; std::tuple<std::string, uint8_t> tuple; std::unordered_map<std::string, std::tuple<std::string, int32_t» map_tuple; std::string default_str; std::vector<std::string> ips; };

// Bare fields are required. YCS_OPT(field, default) is used when the key is // missing. std::optional fields must be declared explicitly. YCS_ADD_STRUCT(AccountInfo, flag, name, address, YCS_OPT(num, std::nullopt), msec, tuple, map_tuple, YCS_OPT(default_str, “hello default”), ips)

// Optional: read APP_* environment variables automatically in from_yaml(). YCS_ENV_PREFIX(AccountInfo, “APP_”)

int main(int, char** argv) { auto cfg_result = yaml_cpp_struct::from_yaml(argv[1]); if (!cfg_result) { std::cerr << yaml_cpp_struct::format_error(cfg_result.error) << '\n'; return 1;

File truncated at 100 lines see the full file

No version for distro kilted showing github. Known supported distros are highlighted in the buttons above.
Repo symbol

yaml_cpp_struct repository

yaml_cpp_struct

ROS Distro
github

Repository Summary

Description
Checkout URI https://github.com/fantasy-peak/yaml_cpp_struct.git
VCS Type git
VCS Version main
Last Updated 2026-11-25
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
yaml_cpp_struct 0.0.1

README

yaml_cpp_struct

function

It’s a header-only wrapper. It’s easy to map YAML documents to C++ structs.

  • (De)serialization for structs, enums, std::optional, std::variant, std::tuple, std::chrono::duration, std::vector, std::list, std::deque, std::forward_list, std::array, std::map, std::unordered_map, std::set, std::unordered_set (including custom comparators/hashers), std::filesystem::path, …
  • std::string_view fields are rejected at compile time because the view would dangle; use std::string instead.
  • Fields are required by default. YCS_OPT(field, default) declares an explicit default for a field that may be missing.
  • Registration either outside the struct with YCS_ADD_STRUCT(T, ...) or inside it with YCS_DEFINE(...); both accept the same annotations.
  • Structured errors with field path, line and column, plus a Result<T> API.
  • Node / stream / multi-document APIs (from_node, from_yaml_stream, to_node, from_yaml_all, from_yaml_all_str).
  • Automatic environment variable loading with per-struct prefixes, nested fields, explicit bindings and YAML value parsing.
  • Optional YAML to JSON conversion with OPEN_YAML_TO_JSON.

note

main branch need >= c++17, if you need to use c++11, please use cpp11 branch. cpp11 branch not support std::variant. Please refer to example for cpp11 branch

The example builds against yaml-cpp 0.9.0 and magic_enum; yaml-cpp >= 0.7 should also work.

use examples

// It relies on two other three open source libraries(yaml-cpp, magic_enum), Please refer to CMakeLists.txt of example
git clone https://github.com/fantasy-peak/yaml_cpp_struct.git
cd ./yaml_cpp_struct/example
mkdir build && cd build
cmake ..
make -j 9
./example ../config.yaml
// use xmake
cd ./yaml_cpp_struct/example
xmake build -v
xmake run example ../config.yaml

Example

---
flag: false
name: "fantasy-peak"
address: { "127.0.0.1": 8888, "127.0.0.2": 9999 }
msec: 100
tuple: ["fantasy-peak", 89]
map_tuple: {"fantasy-peak": ["map_tuple", 254]}
ips: ["127.0.0.1"]

```cpp #include

#include

struct AccountInfo { bool flag; std::string name; std::unordered_map<std::string, int> address; std::optional<std::string> num; std::chrono::milliseconds msec; std::tuple<std::string, uint8_t> tuple; std::unordered_map<std::string, std::tuple<std::string, int32_t» map_tuple; std::string default_str; std::vector<std::string> ips; };

// Bare fields are required. YCS_OPT(field, default) is used when the key is // missing. std::optional fields must be declared explicitly. YCS_ADD_STRUCT(AccountInfo, flag, name, address, YCS_OPT(num, std::nullopt), msec, tuple, map_tuple, YCS_OPT(default_str, “hello default”), ips)

// Optional: read APP_* environment variables automatically in from_yaml(). YCS_ENV_PREFIX(AccountInfo, “APP_”)

int main(int, char** argv) { auto cfg_result = yaml_cpp_struct::from_yaml(argv[1]); if (!cfg_result) { std::cerr << yaml_cpp_struct::format_error(cfg_result.error) << '\n'; return 1;

File truncated at 100 lines see the full file

No version for distro lyrical showing github. Known supported distros are highlighted in the buttons above.
Repo symbol

yaml_cpp_struct repository

yaml_cpp_struct

ROS Distro
github

Repository Summary

Description
Checkout URI https://github.com/fantasy-peak/yaml_cpp_struct.git
VCS Type git
VCS Version main
Last Updated 2026-11-25
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
yaml_cpp_struct 0.0.1

README

yaml_cpp_struct

function

It’s a header-only wrapper. It’s easy to map YAML documents to C++ structs.

  • (De)serialization for structs, enums, std::optional, std::variant, std::tuple, std::chrono::duration, std::vector, std::list, std::deque, std::forward_list, std::array, std::map, std::unordered_map, std::set, std::unordered_set (including custom comparators/hashers), std::filesystem::path, …
  • std::string_view fields are rejected at compile time because the view would dangle; use std::string instead.
  • Fields are required by default. YCS_OPT(field, default) declares an explicit default for a field that may be missing.
  • Registration either outside the struct with YCS_ADD_STRUCT(T, ...) or inside it with YCS_DEFINE(...); both accept the same annotations.
  • Structured errors with field path, line and column, plus a Result<T> API.
  • Node / stream / multi-document APIs (from_node, from_yaml_stream, to_node, from_yaml_all, from_yaml_all_str).
  • Automatic environment variable loading with per-struct prefixes, nested fields, explicit bindings and YAML value parsing.
  • Optional YAML to JSON conversion with OPEN_YAML_TO_JSON.

note

main branch need >= c++17, if you need to use c++11, please use cpp11 branch. cpp11 branch not support std::variant. Please refer to example for cpp11 branch

The example builds against yaml-cpp 0.9.0 and magic_enum; yaml-cpp >= 0.7 should also work.

use examples

// It relies on two other three open source libraries(yaml-cpp, magic_enum), Please refer to CMakeLists.txt of example
git clone https://github.com/fantasy-peak/yaml_cpp_struct.git
cd ./yaml_cpp_struct/example
mkdir build && cd build
cmake ..
make -j 9
./example ../config.yaml
// use xmake
cd ./yaml_cpp_struct/example
xmake build -v
xmake run example ../config.yaml

Example

---
flag: false
name: "fantasy-peak"
address: { "127.0.0.1": 8888, "127.0.0.2": 9999 }
msec: 100
tuple: ["fantasy-peak", 89]
map_tuple: {"fantasy-peak": ["map_tuple", 254]}
ips: ["127.0.0.1"]

```cpp #include

#include

struct AccountInfo { bool flag; std::string name; std::unordered_map<std::string, int> address; std::optional<std::string> num; std::chrono::milliseconds msec; std::tuple<std::string, uint8_t> tuple; std::unordered_map<std::string, std::tuple<std::string, int32_t» map_tuple; std::string default_str; std::vector<std::string> ips; };

// Bare fields are required. YCS_OPT(field, default) is used when the key is // missing. std::optional fields must be declared explicitly. YCS_ADD_STRUCT(AccountInfo, flag, name, address, YCS_OPT(num, std::nullopt), msec, tuple, map_tuple, YCS_OPT(default_str, “hello default”), ips)

// Optional: read APP_* environment variables automatically in from_yaml(). YCS_ENV_PREFIX(AccountInfo, “APP_”)

int main(int, char** argv) { auto cfg_result = yaml_cpp_struct::from_yaml(argv[1]); if (!cfg_result) { std::cerr << yaml_cpp_struct::format_error(cfg_result.error) << '\n'; return 1;

File truncated at 100 lines see the full file

No version for distro rolling showing github. Known supported distros are highlighted in the buttons above.
Repo symbol

yaml_cpp_struct repository

yaml_cpp_struct

ROS Distro
github

Repository Summary

Description
Checkout URI https://github.com/fantasy-peak/yaml_cpp_struct.git
VCS Type git
VCS Version main
Last Updated 2026-11-25
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
yaml_cpp_struct 0.0.1

README

yaml_cpp_struct

function

It’s a header-only wrapper. It’s easy to map YAML documents to C++ structs.

  • (De)serialization for structs, enums, std::optional, std::variant, std::tuple, std::chrono::duration, std::vector, std::list, std::deque, std::forward_list, std::array, std::map, std::unordered_map, std::set, std::unordered_set (including custom comparators/hashers), std::filesystem::path, …
  • std::string_view fields are rejected at compile time because the view would dangle; use std::string instead.
  • Fields are required by default. YCS_OPT(field, default) declares an explicit default for a field that may be missing.
  • Registration either outside the struct with YCS_ADD_STRUCT(T, ...) or inside it with YCS_DEFINE(...); both accept the same annotations.
  • Structured errors with field path, line and column, plus a Result<T> API.
  • Node / stream / multi-document APIs (from_node, from_yaml_stream, to_node, from_yaml_all, from_yaml_all_str).
  • Automatic environment variable loading with per-struct prefixes, nested fields, explicit bindings and YAML value parsing.
  • Optional YAML to JSON conversion with OPEN_YAML_TO_JSON.

note

main branch need >= c++17, if you need to use c++11, please use cpp11 branch. cpp11 branch not support std::variant. Please refer to example for cpp11 branch

The example builds against yaml-cpp 0.9.0 and magic_enum; yaml-cpp >= 0.7 should also work.

use examples

// It relies on two other three open source libraries(yaml-cpp, magic_enum), Please refer to CMakeLists.txt of example
git clone https://github.com/fantasy-peak/yaml_cpp_struct.git
cd ./yaml_cpp_struct/example
mkdir build && cd build
cmake ..
make -j 9
./example ../config.yaml
// use xmake
cd ./yaml_cpp_struct/example
xmake build -v
xmake run example ../config.yaml

Example

---
flag: false
name: "fantasy-peak"
address: { "127.0.0.1": 8888, "127.0.0.2": 9999 }
msec: 100
tuple: ["fantasy-peak", 89]
map_tuple: {"fantasy-peak": ["map_tuple", 254]}
ips: ["127.0.0.1"]

```cpp #include

#include

struct AccountInfo { bool flag; std::string name; std::unordered_map<std::string, int> address; std::optional<std::string> num; std::chrono::milliseconds msec; std::tuple<std::string, uint8_t> tuple; std::unordered_map<std::string, std::tuple<std::string, int32_t» map_tuple; std::string default_str; std::vector<std::string> ips; };

// Bare fields are required. YCS_OPT(field, default) is used when the key is // missing. std::optional fields must be declared explicitly. YCS_ADD_STRUCT(AccountInfo, flag, name, address, YCS_OPT(num, std::nullopt), msec, tuple, map_tuple, YCS_OPT(default_str, “hello default”), ips)

// Optional: read APP_* environment variables automatically in from_yaml(). YCS_ENV_PREFIX(AccountInfo, “APP_”)

int main(int, char** argv) { auto cfg_result = yaml_cpp_struct::from_yaml(argv[1]); if (!cfg_result) { std::cerr << yaml_cpp_struct::format_error(cfg_result.error) << '\n'; return 1;

File truncated at 100 lines see the full file

Repo symbol

yaml_cpp_struct repository

yaml_cpp_struct

ROS Distro
github

Repository Summary

Description
Checkout URI https://github.com/fantasy-peak/yaml_cpp_struct.git
VCS Type git
VCS Version main
Last Updated 2026-11-25
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
yaml_cpp_struct 0.0.1

README

yaml_cpp_struct

function

It’s a header-only wrapper. It’s easy to map YAML documents to C++ structs.

  • (De)serialization for structs, enums, std::optional, std::variant, std::tuple, std::chrono::duration, std::vector, std::list, std::deque, std::forward_list, std::array, std::map, std::unordered_map, std::set, std::unordered_set (including custom comparators/hashers), std::filesystem::path, …
  • std::string_view fields are rejected at compile time because the view would dangle; use std::string instead.
  • Fields are required by default. YCS_OPT(field, default) declares an explicit default for a field that may be missing.
  • Registration either outside the struct with YCS_ADD_STRUCT(T, ...) or inside it with YCS_DEFINE(...); both accept the same annotations.
  • Structured errors with field path, line and column, plus a Result<T> API.
  • Node / stream / multi-document APIs (from_node, from_yaml_stream, to_node, from_yaml_all, from_yaml_all_str).
  • Automatic environment variable loading with per-struct prefixes, nested fields, explicit bindings and YAML value parsing.
  • Optional YAML to JSON conversion with OPEN_YAML_TO_JSON.

note

main branch need >= c++17, if you need to use c++11, please use cpp11 branch. cpp11 branch not support std::variant. Please refer to example for cpp11 branch

The example builds against yaml-cpp 0.9.0 and magic_enum; yaml-cpp >= 0.7 should also work.

use examples

// It relies on two other three open source libraries(yaml-cpp, magic_enum), Please refer to CMakeLists.txt of example
git clone https://github.com/fantasy-peak/yaml_cpp_struct.git
cd ./yaml_cpp_struct/example
mkdir build && cd build
cmake ..
make -j 9
./example ../config.yaml
// use xmake
cd ./yaml_cpp_struct/example
xmake build -v
xmake run example ../config.yaml

Example

---
flag: false
name: "fantasy-peak"
address: { "127.0.0.1": 8888, "127.0.0.2": 9999 }
msec: 100
tuple: ["fantasy-peak", 89]
map_tuple: {"fantasy-peak": ["map_tuple", 254]}
ips: ["127.0.0.1"]

```cpp #include

#include

struct AccountInfo { bool flag; std::string name; std::unordered_map<std::string, int> address; std::optional<std::string> num; std::chrono::milliseconds msec; std::tuple<std::string, uint8_t> tuple; std::unordered_map<std::string, std::tuple<std::string, int32_t» map_tuple; std::string default_str; std::vector<std::string> ips; };

// Bare fields are required. YCS_OPT(field, default) is used when the key is // missing. std::optional fields must be declared explicitly. YCS_ADD_STRUCT(AccountInfo, flag, name, address, YCS_OPT(num, std::nullopt), msec, tuple, map_tuple, YCS_OPT(default_str, “hello default”), ips)

// Optional: read APP_* environment variables automatically in from_yaml(). YCS_ENV_PREFIX(AccountInfo, “APP_”)

int main(int, char** argv) { auto cfg_result = yaml_cpp_struct::from_yaml(argv[1]); if (!cfg_result) { std::cerr << yaml_cpp_struct::format_error(cfg_result.error) << '\n'; return 1;

File truncated at 100 lines see the full file

No version for distro galactic showing github. Known supported distros are highlighted in the buttons above.
Repo symbol

yaml_cpp_struct repository

yaml_cpp_struct

ROS Distro
github

Repository Summary

Description
Checkout URI https://github.com/fantasy-peak/yaml_cpp_struct.git
VCS Type git
VCS Version main
Last Updated 2026-11-25
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
yaml_cpp_struct 0.0.1

README

yaml_cpp_struct

function

It’s a header-only wrapper. It’s easy to map YAML documents to C++ structs.

  • (De)serialization for structs, enums, std::optional, std::variant, std::tuple, std::chrono::duration, std::vector, std::list, std::deque, std::forward_list, std::array, std::map, std::unordered_map, std::set, std::unordered_set (including custom comparators/hashers), std::filesystem::path, …
  • std::string_view fields are rejected at compile time because the view would dangle; use std::string instead.
  • Fields are required by default. YCS_OPT(field, default) declares an explicit default for a field that may be missing.
  • Registration either outside the struct with YCS_ADD_STRUCT(T, ...) or inside it with YCS_DEFINE(...); both accept the same annotations.
  • Structured errors with field path, line and column, plus a Result<T> API.
  • Node / stream / multi-document APIs (from_node, from_yaml_stream, to_node, from_yaml_all, from_yaml_all_str).
  • Automatic environment variable loading with per-struct prefixes, nested fields, explicit bindings and YAML value parsing.
  • Optional YAML to JSON conversion with OPEN_YAML_TO_JSON.

note

main branch need >= c++17, if you need to use c++11, please use cpp11 branch. cpp11 branch not support std::variant. Please refer to example for cpp11 branch

The example builds against yaml-cpp 0.9.0 and magic_enum; yaml-cpp >= 0.7 should also work.

use examples

// It relies on two other three open source libraries(yaml-cpp, magic_enum), Please refer to CMakeLists.txt of example
git clone https://github.com/fantasy-peak/yaml_cpp_struct.git
cd ./yaml_cpp_struct/example
mkdir build && cd build
cmake ..
make -j 9
./example ../config.yaml
// use xmake
cd ./yaml_cpp_struct/example
xmake build -v
xmake run example ../config.yaml

Example

---
flag: false
name: "fantasy-peak"
address: { "127.0.0.1": 8888, "127.0.0.2": 9999 }
msec: 100
tuple: ["fantasy-peak", 89]
map_tuple: {"fantasy-peak": ["map_tuple", 254]}
ips: ["127.0.0.1"]

```cpp #include

#include

struct AccountInfo { bool flag; std::string name; std::unordered_map<std::string, int> address; std::optional<std::string> num; std::chrono::milliseconds msec; std::tuple<std::string, uint8_t> tuple; std::unordered_map<std::string, std::tuple<std::string, int32_t» map_tuple; std::string default_str; std::vector<std::string> ips; };

// Bare fields are required. YCS_OPT(field, default) is used when the key is // missing. std::optional fields must be declared explicitly. YCS_ADD_STRUCT(AccountInfo, flag, name, address, YCS_OPT(num, std::nullopt), msec, tuple, map_tuple, YCS_OPT(default_str, “hello default”), ips)

// Optional: read APP_* environment variables automatically in from_yaml(). YCS_ENV_PREFIX(AccountInfo, “APP_”)

int main(int, char** argv) { auto cfg_result = yaml_cpp_struct::from_yaml(argv[1]); if (!cfg_result) { std::cerr << yaml_cpp_struct::format_error(cfg_result.error) << '\n'; return 1;

File truncated at 100 lines see the full file

No version for distro iron showing github. Known supported distros are highlighted in the buttons above.
Repo symbol

yaml_cpp_struct repository

yaml_cpp_struct

ROS Distro
github

Repository Summary

Description
Checkout URI https://github.com/fantasy-peak/yaml_cpp_struct.git
VCS Type git
VCS Version main
Last Updated 2026-11-25
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
yaml_cpp_struct 0.0.1

README

yaml_cpp_struct

function

It’s a header-only wrapper. It’s easy to map YAML documents to C++ structs.

  • (De)serialization for structs, enums, std::optional, std::variant, std::tuple, std::chrono::duration, std::vector, std::list, std::deque, std::forward_list, std::array, std::map, std::unordered_map, std::set, std::unordered_set (including custom comparators/hashers), std::filesystem::path, …
  • std::string_view fields are rejected at compile time because the view would dangle; use std::string instead.
  • Fields are required by default. YCS_OPT(field, default) declares an explicit default for a field that may be missing.
  • Registration either outside the struct with YCS_ADD_STRUCT(T, ...) or inside it with YCS_DEFINE(...); both accept the same annotations.
  • Structured errors with field path, line and column, plus a Result<T> API.
  • Node / stream / multi-document APIs (from_node, from_yaml_stream, to_node, from_yaml_all, from_yaml_all_str).
  • Automatic environment variable loading with per-struct prefixes, nested fields, explicit bindings and YAML value parsing.
  • Optional YAML to JSON conversion with OPEN_YAML_TO_JSON.

note

main branch need >= c++17, if you need to use c++11, please use cpp11 branch. cpp11 branch not support std::variant. Please refer to example for cpp11 branch

The example builds against yaml-cpp 0.9.0 and magic_enum; yaml-cpp >= 0.7 should also work.

use examples

// It relies on two other three open source libraries(yaml-cpp, magic_enum), Please refer to CMakeLists.txt of example
git clone https://github.com/fantasy-peak/yaml_cpp_struct.git
cd ./yaml_cpp_struct/example
mkdir build && cd build
cmake ..
make -j 9
./example ../config.yaml
// use xmake
cd ./yaml_cpp_struct/example
xmake build -v
xmake run example ../config.yaml

Example

---
flag: false
name: "fantasy-peak"
address: { "127.0.0.1": 8888, "127.0.0.2": 9999 }
msec: 100
tuple: ["fantasy-peak", 89]
map_tuple: {"fantasy-peak": ["map_tuple", 254]}
ips: ["127.0.0.1"]

```cpp #include

#include

struct AccountInfo { bool flag; std::string name; std::unordered_map<std::string, int> address; std::optional<std::string> num; std::chrono::milliseconds msec; std::tuple<std::string, uint8_t> tuple; std::unordered_map<std::string, std::tuple<std::string, int32_t» map_tuple; std::string default_str; std::vector<std::string> ips; };

// Bare fields are required. YCS_OPT(field, default) is used when the key is // missing. std::optional fields must be declared explicitly. YCS_ADD_STRUCT(AccountInfo, flag, name, address, YCS_OPT(num, std::nullopt), msec, tuple, map_tuple, YCS_OPT(default_str, “hello default”), ips)

// Optional: read APP_* environment variables automatically in from_yaml(). YCS_ENV_PREFIX(AccountInfo, “APP_”)

int main(int, char** argv) { auto cfg_result = yaml_cpp_struct::from_yaml(argv[1]); if (!cfg_result) { std::cerr << yaml_cpp_struct::format_error(cfg_result.error) << '\n'; return 1;

File truncated at 100 lines see the full file

No version for distro melodic showing github. Known supported distros are highlighted in the buttons above.
Repo symbol

yaml_cpp_struct repository

yaml_cpp_struct

ROS Distro
github

Repository Summary

Description
Checkout URI https://github.com/fantasy-peak/yaml_cpp_struct.git
VCS Type git
VCS Version main
Last Updated 2026-11-25
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
yaml_cpp_struct 0.0.1

README

yaml_cpp_struct

function

It’s a header-only wrapper. It’s easy to map YAML documents to C++ structs.

  • (De)serialization for structs, enums, std::optional, std::variant, std::tuple, std::chrono::duration, std::vector, std::list, std::deque, std::forward_list, std::array, std::map, std::unordered_map, std::set, std::unordered_set (including custom comparators/hashers), std::filesystem::path, …
  • std::string_view fields are rejected at compile time because the view would dangle; use std::string instead.
  • Fields are required by default. YCS_OPT(field, default) declares an explicit default for a field that may be missing.
  • Registration either outside the struct with YCS_ADD_STRUCT(T, ...) or inside it with YCS_DEFINE(...); both accept the same annotations.
  • Structured errors with field path, line and column, plus a Result<T> API.
  • Node / stream / multi-document APIs (from_node, from_yaml_stream, to_node, from_yaml_all, from_yaml_all_str).
  • Automatic environment variable loading with per-struct prefixes, nested fields, explicit bindings and YAML value parsing.
  • Optional YAML to JSON conversion with OPEN_YAML_TO_JSON.

note

main branch need >= c++17, if you need to use c++11, please use cpp11 branch. cpp11 branch not support std::variant. Please refer to example for cpp11 branch

The example builds against yaml-cpp 0.9.0 and magic_enum; yaml-cpp >= 0.7 should also work.

use examples

// It relies on two other three open source libraries(yaml-cpp, magic_enum), Please refer to CMakeLists.txt of example
git clone https://github.com/fantasy-peak/yaml_cpp_struct.git
cd ./yaml_cpp_struct/example
mkdir build && cd build
cmake ..
make -j 9
./example ../config.yaml
// use xmake
cd ./yaml_cpp_struct/example
xmake build -v
xmake run example ../config.yaml

Example

---
flag: false
name: "fantasy-peak"
address: { "127.0.0.1": 8888, "127.0.0.2": 9999 }
msec: 100
tuple: ["fantasy-peak", 89]
map_tuple: {"fantasy-peak": ["map_tuple", 254]}
ips: ["127.0.0.1"]

```cpp #include

#include

struct AccountInfo { bool flag; std::string name; std::unordered_map<std::string, int> address; std::optional<std::string> num; std::chrono::milliseconds msec; std::tuple<std::string, uint8_t> tuple; std::unordered_map<std::string, std::tuple<std::string, int32_t» map_tuple; std::string default_str; std::vector<std::string> ips; };

// Bare fields are required. YCS_OPT(field, default) is used when the key is // missing. std::optional fields must be declared explicitly. YCS_ADD_STRUCT(AccountInfo, flag, name, address, YCS_OPT(num, std::nullopt), msec, tuple, map_tuple, YCS_OPT(default_str, “hello default”), ips)

// Optional: read APP_* environment variables automatically in from_yaml(). YCS_ENV_PREFIX(AccountInfo, “APP_”)

int main(int, char** argv) { auto cfg_result = yaml_cpp_struct::from_yaml(argv[1]); if (!cfg_result) { std::cerr << yaml_cpp_struct::format_error(cfg_result.error) << '\n'; return 1;

File truncated at 100 lines see the full file

No version for distro noetic showing github. Known supported distros are highlighted in the buttons above.
Repo symbol

yaml_cpp_struct repository

yaml_cpp_struct

ROS Distro
github

Repository Summary

Description
Checkout URI https://github.com/fantasy-peak/yaml_cpp_struct.git
VCS Type git
VCS Version main
Last Updated 2026-11-25
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Packages

Name Version
yaml_cpp_struct 0.0.1

README

yaml_cpp_struct

function

It’s a header-only wrapper. It’s easy to map YAML documents to C++ structs.

  • (De)serialization for structs, enums, std::optional, std::variant, std::tuple, std::chrono::duration, std::vector, std::list, std::deque, std::forward_list, std::array, std::map, std::unordered_map, std::set, std::unordered_set (including custom comparators/hashers), std::filesystem::path, …
  • std::string_view fields are rejected at compile time because the view would dangle; use std::string instead.
  • Fields are required by default. YCS_OPT(field, default) declares an explicit default for a field that may be missing.
  • Registration either outside the struct with YCS_ADD_STRUCT(T, ...) or inside it with YCS_DEFINE(...); both accept the same annotations.
  • Structured errors with field path, line and column, plus a Result<T> API.
  • Node / stream / multi-document APIs (from_node, from_yaml_stream, to_node, from_yaml_all, from_yaml_all_str).
  • Automatic environment variable loading with per-struct prefixes, nested fields, explicit bindings and YAML value parsing.
  • Optional YAML to JSON conversion with OPEN_YAML_TO_JSON.

note

main branch need >= c++17, if you need to use c++11, please use cpp11 branch. cpp11 branch not support std::variant. Please refer to example for cpp11 branch

The example builds against yaml-cpp 0.9.0 and magic_enum; yaml-cpp >= 0.7 should also work.

use examples

// It relies on two other three open source libraries(yaml-cpp, magic_enum), Please refer to CMakeLists.txt of example
git clone https://github.com/fantasy-peak/yaml_cpp_struct.git
cd ./yaml_cpp_struct/example
mkdir build && cd build
cmake ..
make -j 9
./example ../config.yaml
// use xmake
cd ./yaml_cpp_struct/example
xmake build -v
xmake run example ../config.yaml

Example

---
flag: false
name: "fantasy-peak"
address: { "127.0.0.1": 8888, "127.0.0.2": 9999 }
msec: 100
tuple: ["fantasy-peak", 89]
map_tuple: {"fantasy-peak": ["map_tuple", 254]}
ips: ["127.0.0.1"]

```cpp #include

#include

struct AccountInfo { bool flag; std::string name; std::unordered_map<std::string, int> address; std::optional<std::string> num; std::chrono::milliseconds msec; std::tuple<std::string, uint8_t> tuple; std::unordered_map<std::string, std::tuple<std::string, int32_t» map_tuple; std::string default_str; std::vector<std::string> ips; };

// Bare fields are required. YCS_OPT(field, default) is used when the key is // missing. std::optional fields must be declared explicitly. YCS_ADD_STRUCT(AccountInfo, flag, name, address, YCS_OPT(num, std::nullopt), msec, tuple, map_tuple, YCS_OPT(default_str, “hello default”), ips)

// Optional: read APP_* environment variables automatically in from_yaml(). YCS_ENV_PREFIX(AccountInfo, “APP_”)

int main(int, char** argv) { auto cfg_result = yaml_cpp_struct::from_yaml(argv[1]); if (!cfg_result) { std::cerr << yaml_cpp_struct::format_error(cfg_result.error) << '\n'; return 1;

File truncated at 100 lines see the full file