-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested structure with std::optional types #5
Comments
could you provide a complete example |
yaml_cpp_struct/example/main.cpp Line 174 in 9724ab3
|
I'm using main.cpp: #include <optional>
#include <yaml_cpp_struct.hpp>
struct Settings
{
int32_t port;
std::optional<int32_t> thread_count;
};
YCS_ADD_STRUCT(Settings, port, thread_count);
struct Config
{
Settings settings;
};
YCS_ADD_STRUCT(Config, settings);
int main(int argc, char **argv)
{
auto [config_opt, error] = yaml_cpp_struct::from_yaml<Config>("./config.yaml");
} config.yaml settings:
port: 5555 Error:
|
This exception seems to be thrown by yaml cpp,I don't have the Windows development environment at hand. I checked with memory tools on Linux and didn't find any problems. I need to study it carefully |
|
could you use test branch for test ? https://github.com/fantasy-peak/yaml_cpp_struct/tree/test |
It seems like gives an error when deserializing nested structs that have optional fields. Example:
The text was updated successfully, but these errors were encountered: