seg fault trying to access [] operator on YAML::Node
I'm trying to use yaml-cpp to read a yaml file, but it is giving me a seg
fault on what seems like a pretty simple use case:
// .h
class Options {
private:
static const YAML::Node file;
public:
template<typename T>
static T get(std::string option){
std::cout << file << std::endl;
return file[option].as<T>(); // <------- seg fault
}
};
// .cpp
const YAML::Node Options::file = YAML::LoadFile("data/init.yml");
// main
...
cout << Options::get<unsigned>("Width"); // <------- seg fault
...
The application prints this before crashing:
Width: 1024
So it looks like the file is definitely being parsed correctly... what am
I doing wrong?
No comments:
Post a Comment