The following unit test fails
#include "gtest/gtest.h"
#include <yaml-cpp/yaml.h>
#include <vector>
TEST(VectorErase, ProducesVectorContainingCorrectElements) {
YAML::Node a;
a["name"] = "a";
YAML::Node b;
b["name"] = "b";
YAML::Node c;
c["name"] = "c";
std::vector<YAML::Node> vec{a, b, c};
vec.erase(vec.begin());
EXPECT_EQ(vec[0]["name"].as<std::string>(), "b");
}
When vec.erase(vec.begin()) is called, instead of vec containing names {"b", "c"}, it instead contains names {"c", "c"}.
My guess is that this is something to do with aliasing rather than copying when the vector elements are moved. This is likely an issue with the move constructor or move assignment of the Node.
I am using libcpp-yaml0.6, as I am currently limited to Ubuntu 20.04.