Skip to content

Various fixes for MSVC 2019

T.J. Corona requested to merge tjcorona/smtk:msvc2019-fixes into master

MSVC 2019 has updated its treatment of std::(unordered_)map, and the current implementation is (correctly) more restrictive about preventing copying. Classes that contain a map that holds uncopyable data are not flagged to have their copy ctor implicitly deleted, though; in ambiguous cases where a class instance that contains a move-only map can be either copied or moved, the compiler chooses the copy and errors out when the map's elements cannot be copied. This issue can be circumvented by explicilty deleting the copy ctor and copy assignment operator of classes that contain move-only maps.

Additionally, nlohmann::json's implicit cast to std::string (which is disfavored in its documentation) causes an error due to the ambiguity of copy vs move. The issue is solved by simply using nlohmann::json's explicit cast method to retrieve string elements as a std::string.

Edited by T.J. Corona

Merge request reports