Skip to content

use std::optional in place of bool+returning by reference for YAML::convert::decode #696

Closed

Description

@exprosic-2

#697

Since std::optional (specified by C++17) is now implemented by major compilers, it should make sense to relax the restriction of having a default constructor of the type to be decoded by adding an overload

  • std::optional<T> YAML::convert::decode(const Node&);

for

  • bool YAML::convert::decode(const Node&, T&);

if possible.

Activity

  1. david-antiteum commented on Apr 8, 2019

    @david-antiteum

    IMHO it will better to wait (or use one of the unofficial implementations) for std::expected to change the api.

  2. jbeder commented on Aug 3, 2019

    @jbeder
    Owner

    Yeah, I think I agree with @david-antiteum, or at least, I don’t think optional is the right type here.

  3. SGSSGene commented on Jul 8, 2026

    @SGSSGene
    Collaborator

    Currently we are compatible with back to c++11, so using std::optional/std::variant/std::expected is not an option.

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