Description
When I use macro 'NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT' to transfer ordered_json to class, the class contains a nlohmann::ordered_map, compile error
Reproduction steps
#include <iostream>
#include <nlohmann/json.hpp>
using namespace std;
using nlohmann::ordered_json;
using nlohmann::ordered_map;
struct J_Data {
float b = 2;
ordered_map<string, string> c;
int a = 1;
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(J_Data, b, c, a)
};
int main() {
J_Data data1;
ordered_json j = data1;
cout << "j: " << j << endl;
J_Data data2 = j;
cout << "j: " << j << endl;
return 0;
}
compiler error:
/usr/include/c++/10/bits/stl_algobase.h:380:18: error: use of deleted function ‘std::pair<const std::__cxx11::basic_string, std::__cxx11::basic_string >& std::pair<const std::__cxx11::basic_string, std::__cxx11::basic_string >::operator=(const std::pair<const std::__cxx11::basic_string, std::__cxx11::basic_string >&)’
380 | *__result = *__first;
Expected vs. actual results
fix the bug
Minimal code example
Error messages
Compiler and operating system
ubuntu20
Library version
gcc version 10.5.0
Validation
Description
When I use macro 'NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT' to transfer ordered_json to class, the class contains a nlohmann::ordered_map, compile error
Reproduction steps
compiler error:
/usr/include/c++/10/bits/stl_algobase.h:380:18: error: use of deleted function ‘std::pair<const std::__cxx11::basic_string, std::__cxx11::basic_string >& std::pair<const std::__cxx11::basic_string, std::__cxx11::basic_string >::operator=(const std::pair<const std::__cxx11::basic_string, std::__cxx11::basic_string >&)’
380 | *__result = *__first;
Expected vs. actual results
fix the bug
Minimal code example
Error messages
Compiler and operating system
ubuntu20
Library version
gcc version 10.5.0
Validation
developbranch is used.