Код: Выделить всё
[Calculator_parameters]
dontVary = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Я пробовал что-то вроде:
Код: Выделить всё
#include
#include // Include for file stream operations
#include "toml.hpp"
#include
#include
#include
using namespace std;
int main(int argc, char* argv[])
{
toml::table tbl;
tbl = toml::parse(file); // file is some string that I get from user input. This part works for sure.
...
auto dontVary_array = tbl["Calculator_parameters"]["dontVary"];
vector dontVary;
if (toml::array* arr = dontVary_array.as_array()) {
arr->for_each([&dontVary](auto&& el)
{
if (const auto* int_elem = el.as_integer())
dontVary.push_back((int)(*int_elem)); //Type mismatch somewhere here???
else
cerr
Подробнее здесь: [url]https://stackoverflow.com/questions/78266480/toml-conversion-to-vectorintc[/url]