This commit is contained in:
2025-02-25 09:17:10 +03:00
parent 5b89a968eb
commit c64baf6e35
2 changed files with 8 additions and 7 deletions

View File

@@ -1,5 +1,4 @@
#include <iostream>
#include <strstream>
#include "../comm_server_configfile.h"
@@ -14,10 +13,11 @@ int main(int argc, char* argv[])
auto print_cfg = [](auto const& cfg) {
for (auto& [key, v] : cfg.config()) {
std::cout << key << " = ";
std::cout << key;
if (auto v_str = std::get_if<1>(&v)) {
std::cout << *v_str;
std::cout << " = " << *v_str;
} else if (auto v_vec = std::get_if<2>(&v)) {
std::cout << " = ";
for (auto& el : *v_vec) {
std::cout << "<" << el << "> ";
}
@@ -36,7 +36,8 @@ int main(int argc, char* argv[])
vec_key = 1,2,3 , 345, 4576, 79
)--";
std::istrstream ist(str.c_str());
std::stringstream ist;
ist << str;
cfg.load(ist);
std::cout << "From input stream: \n";