Is there a way to transform a QMap to a QJsonObject?
I tried this as follows, but it fails (on MSVC):
QMap<QString, QString> values{{"hi", "there"}};
auto js = kdalgorithms::transformed_with_new_return_type<QJsonObject>(
values, [](const auto& item) -> std::pair<QString, QJsonValue> {
return std::make_pair<QString, QJsonValue>(item.first, item.second);
});
Lots of errors, including
1>C:\dev\cpp\libs\vcpkg_installed\x64-windows\include\kdalgorithms\kdalgorithms_bits\transform.h(48,60): error C2672: 'insert_wrapper': no matching overloaded function found
1>C:\dev\cpp\libs\vcpkg_installed\x64-windows\include\kdalgorithms\kdalgorithms_bits\transform.h(48,14): error C2672: 'transform': no matching overloaded function found
I also tried converting to initializer_list as QJsonObject has a constructor that accepts that, but the result was the same:
auto js2 = kdalgorithms::transformed_with_new_return_type<std::initializer_list<std::pair<QString, QJsonValue>>>(
values, [](const auto& item) /* -> std::pair<QString, QJsonValue>*/ {
return std::make_pair<QString, QJsonValue>(item.first, item.second);
});
Is there a way to transform a QMap to a QJsonObject?
I tried this as follows, but it fails (on MSVC):
Lots of errors, including
I also tried converting to
initializer_listas QJsonObject has a constructor that accepts that, but the result was the same: