Consider the folllowing C++03 code (I have to make the code compatible with pre-C++11 compilers):
// This class belongs to a third-party SDK and cannot be touched
class A {
public:
explicit A();
explicit A(bool b);
private:
// Non-copyable
A(const A&);
const A& operator= (const A&);
}
boost::container::map<int, A> myMap;
Using a Boost map here because it allows emplacing even in C++03. The problem is that I can perflectly emplace-construct into the map if using the one-argument constructor, but I don't know how to default-construct the object, as this code illustrates:
myMap.emplace(1, true); // Works
myMap.emplace(1); // Fails
The second call fails because it's taken as a call to the emplace(std::pair...) overload so it seems there is no way to "default-emplace".
Is there any way to achieve what I want?