Skip to content
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

Is it possiable to disable exception? #930

Open
owent opened this issue Jul 31, 2020 · 2 comments · May be fixed by #1146
Open

Is it possiable to disable exception? #930

owent opened this issue Jul 31, 2020 · 2 comments · May be fixed by #1146

Comments

@owent
Copy link

owent commented Jul 31, 2020

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.

@champignoom
Copy link

It would require the std::expected (see #696) which is not likely to arrive within years.

@twestenkarl twestenkarl linked a pull request Oct 21, 2022 that will close this issue
@josiest
Copy link

josiest commented Nov 13, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants