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

Abierto
#1,448 2 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
cpp, yaml
Área
backend

Línea de trabajo

Start by reading the public Node API and its tests to see how operator[] handles both reads and writes, including missing keys and exceptions. Identify an alternative function that supports both operations and determine its expected behavior from the existing API. Done means the proposed API is clear and tested for reading and writing YAML nodes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
C++
Estrellas
6.1k
Forks
2.2k
Merge medio
22 h 2 min
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de jbeder/yaml-cpp

Todos los issues de jbeder/yaml-cpp

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.