On MSVC (latest) the following code yields a compile error with flat_map,
but not with std::map. I do not have the knowledge of std::less<> to
resolve what causes the error.
auto fm = boost::container::flat_map >{};
auto m = std::map >{};
auto k = std::string_view{ "my_key" };
auto x = m.find(k); // Compiles
auto y = fm.find(k); // Does NOT compile
Error message:
1>boost\container\flat_map.hpp(1314): error C2664:
'boost::container::vec_iterator *,true>
boost::container::dtl::flat_tree,boost::container::dtl::select1st<Key>,Compare,boost::container::new_allocator<T2>>::find(const
std::basic_string &)
const': cannot convert argument 1 from 'const std::string_view' to 'const
std::basic_string &'
1> with
1> [
1> Key=std::string,
1> T=int,
1> Compare=std::less<void>,
1> T2=boost::container::dtl::pairstd::string,int
1> ]
1> boost\container\flat_map.hpp(1314): note: Reason: cannot convert from
'const std::string_view' to 'const
std::basic_string'
1> boost\container\flat_map.hpp(1314): note: No user-defined-conversion
operator available that can perform this conversion, or the operator cannot
be called
Best regards
/Viktor