I want to use boost::bind
to create a boost::function
inserting a new key-value pair into a boost::unoredered_map
but I got few compilation errors.
typedef boost::unordered_map<
std::string, std::string > dict_type;
inline void insert( const std::string& key, const std::string& value ){
typedef std::pair<dict_type::iterator, bool> out_type;
dict_type::value_type to_insert(key,value);
boost::function<void()> f = boost::bind<out_type>(
&dict_type::insert
,obj_
,boost::cref(to_insert)
);
}
The error below looks like bind
cannot find the right overload for unordered_map::insert
. In this case I specify exactly the right overload but this time it doesn't work. Do you know what it is?
../include2/llve_clorder_id.h:32: error: no matching function for call to
'bind(<unresolved overloaded function type>,
boost::unordered_map<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, boost::hash<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >, std::equal_to<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > > >&, const
boost::reference_wrapper<const std::pair<const std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > >)'