If I add a custom hasher to a map this code does not compile:
template <typename T>
struct dummy {
std::size_t operator()(const T& v) const { return std::hash<T>()(v); }
};
typedef std::unordered_map<int, string> Map;
// typedef std::unordered_map<int, string, dummy<int>> Map; // <-- does not compile
Map map{{1, ""}};
std::string out = rfl::json::write(map);
I get this error with the commented line:
error: vcpkg_installed\x64-windows-static\include\rfl\json\Writer.hpp:121:21: error: static assertion failed due to requirement 'rfl::always_false_v<std::unordered_map<int, std::basic_string<char, std::char_traits, std::allocator>, dummy, std::equal_to, std::allocator<std::pair<const int, std::basic_string<char, std::char_traits, std::allocator>>>>>': Unsupported type.
Can maps with custom hashers be supported?
If I add a custom hasher to a map this code does not compile:
I get this error with the commented line:
Can maps with custom hashers be supported?