Skip to content

New function as alternative to operator[] for read and write #1448

Description

@Spixmaster

Example:

YAML::Node node = YAML::LoadFile(constant::file::configuration);
const double commission_factor = node["factor"].as<double>();
node["factor"] = 4.532;

It would be beneficial to have an alternative function instead of the overloaded operator operator[] to please the clang-tidy recommendation to not use overloaded operator[], https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-bounds-avoid-unchecked-container-access.html. This is needed for read and write operations.

This makes sense as in the STL operator[] does not throw exceptions but rather aborts the programme and thus is not recommended.

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