yaml-cpp
yaml-cpp copied to clipboard
Is it possiable to disable exception?
Is it possiable to disable exception?
In some environment, exception and RTTI is disabled, I found RTTI is only used by gtest, but there is no way to disable exception. I think it's better to provide a error handle instead of throw when exception is disabled.
It would require the std::expected (see https://github.com/jbeder/yaml-cpp/issues/696) which is not likely to arrive within years.
std::expected is available with some compilers. I'm thinking of making a fork that supports this for my own needs/desires. I think a good interface would look something like
template<T>
std::expected<T, YAML::Exception>
YAML::Node::expect() const noexcept;
// example
auto result = node["value"].expect<std::string>();
Since this would be similar to the Node::as method. If I get it to a point that feels stable, are there guidelines for contributing somewhere?