I'm having trouble using map::emplace()
. Can anyone help me figure out the right syntax to use? I am effectively trying to do the same thing as in this example. Here is my version:
#include <map>
using namespace std;
class Foo
{
// private members
public:
Foo(int, char, char) /* :init(), members() */ { }
// no default ctor, copy ctor, move ctor, or assignment
Foo() = delete;
Foo(const Foo&) = delete;
Foo(Foo &&) = delete;
Foo & operator=(const Foo &) = delete;
Foo & operator=(Foo &&) = delete;
};
int main()
{
map<int, Foo> mymap;
mymap.emplace(5, 5, 'a', 'b');
return 0;
}
Under GCC 4.7 (with the -std=c++11
flag), I am erroring out on the emplace
line. The example I linked above doesn't say anything about how to deal with custom types instead of primitives.