Skip to content

Is it possiable to disable exception? #930

Open

Description

@owent

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.

Activity

  1. champignoom commented on Dec 11, 2020

    @champignoom

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

  2. josiest commented on Nov 13, 2022

    @josiest

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions