Opened 7 years ago

Closed 7 years ago

#833 closed defect (duplicate)

get functions doesn't allow implicit conversion

Reported by: Peter Owned by: Peter
Priority: minor Milestone:
Component: utility Version: trunk
Keywords: Cc:


The function 'get' doesn't allow implicit conversion of second argument

template <typename Key, typename Tp, typename Compare, typename Alloc>
const Tp& get(const std::map<Key, Tp, Compare, Alloc>& m, const Key& key)

For instance, I have a map<string, size_t> m and I try to call get with

get(m, "foo");

which doesn't work because the "foo" is a char[4] and not an std::string

no matching function for call to ‘get(std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, long unsigned int, std::less<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> >, long unsigned int> > >&, const char [4])’

Change History (3)

comment:1 Changed 7 years ago by Peter

Milestone: yat 0.x+yat 0.14

comment:2 Changed 7 years ago by Peter

Status: newassigned

comment:3 Changed 7 years ago by Peter

Milestone: yat 0.14
Resolution: duplicate
Status: assignedclosed

duplicate of #799

Note: See TracTickets for help on using tickets.