The emplace container emplace creates the element using the provided arguments.
value_type your map is std::pair<const int, Foo> and this type does not have a constructor that takes arguments { 5, 5, 'a', 'b' } ie, this will not work:
std::pair<const int, Foo> value{ 5, 5, 'a', 'b' }; map.emplace(value);
You need to call emplace with arguments that match one of the pair constructors.
With the appropriate C ++ 11 implementation, you can use:
mymap.emplace(std::piecewise_construct, std::make_tuple(5), std::make_tuple(5, 'a', 'b'));
but GCC 4.7 also does not support this syntax (GCC 4.8 will be released.)
Jonathan Wakely Dec 28 '12 at 20:48 2012-12-28 20:48
source share