Copyright Matus Chochlik. Distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
#include <iostream>
auto main(main_ctx& ctx) -> int {
const std::string na{"N/A"};
auto& cfg = ctx.config();
std::string s;
int i;
std::vector<float> v;
if(cfg.fetch("value_1", s)) {
std::cout << "string: " << s << std::endl;
}
if(cfg.fetch("value_2", s)) {
std::cout << "string: " << s << std::endl;
}
if(cfg.fetch("section_a.subsection_b.value_c", i)) {
std::cout << "integer: " << i << std::endl;
}
if(cfg.fetch("section_a.subsection_b.values", v)) {
std::cout << "floats:";
for(auto e : v) {
std::cout << " " << e;
}
std::cout << std::endl;
}
return 0;
}
}