을 사용하여 boost::unoredered_map
에 새로운 키 - 값 쌍을 삽입하는 boost::function
을 만들고 싶지만 컴파일 오류가 거의 없습니다.boost :: bind 및 boost :: unordered_map의 삽입
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)
);
}
오류는 아래 unordered_map::insert
에 적합한 과부하를 찾을 수 없습니다 bind
것 같습니다. 이 경우 정확한 오버로드를 지정하지만 이번에는 작동하지 않습니다. 그게 뭔지 아십니까?
../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> > > >)'
컴파일러 버전을 지정할 수 있습니까? 부분 특수화를 이해하지 못하는 일부 오래된 컴파일러는'boost :: bind'에 대한 첫 번째 인수로 함수 멤버에 대한 포인터를 받아 들일 수 없습니다. –