add table and array

This commit is contained in:
ToruNiina
2017-04-16 16:38:02 +09:00
parent 8657c45d04
commit 6ffd233bce

View File

@@ -10,13 +10,30 @@ int main()
toml::value v3(f);
toml::value v4("hoge");
std::cout << "v1: " << v1.t() << " = " << v1.cast<toml::type::Integer>() << std::endl;
std::cout << "v2: " << v2.t() << " = " << v2.cast<toml::type::Boolean>() << std::endl;
std::cout << "v3: " << v3.t() << " = " << v3.cast<toml::type::Float>() << std::endl;
std::cout << "v4: " << v4.t() << " = " << v4.cast<toml::type::String>() << std::endl;
std::cout << "v1: " << v1.type() << " = " << v1.cast<toml::value_t::Integer>() << std::endl;
std::cout << "v2: " << v2.type() << " = " << v2.cast<toml::value_t::Boolean>() << std::endl;
std::cout << "v3: " << v3.type() << " = " << v3.cast<toml::value_t::Float>() << std::endl;
std::cout << "v4: " << v4.type() << " = " << v4.cast<toml::value_t::String>() << std::endl;
v1.reset(f);
std::cout << "v1: " << v1.t() << " = " << v1.cast<toml::type::Float>() << std::endl;
std::cout << "v1: " << v1.type() << " = " << v1.cast<toml::value_t::Float>() << std::endl;
toml::Table tab;
tab["v1"] = v1;
tab["v2"] = v2;
tab["v3"] = v3;
tab["v4"] = v4;
toml::Array arr;
arr.emplace_back(3);
arr.emplace_back(1);
arr.emplace_back(4);
arr.emplace_back(1);
arr.emplace_back(5);
toml::value v5(tab);
std::cout << "v5: " << v5.type() << std::endl;
toml::value v6(arr);
std::cout << "v6: " << v6.type() << std::endl;
return 0;
}