what to use in place of std::map::emplace?

Posted by kfmfe04 on Stack Overflow See other posts from Stack Overflow or by kfmfe04
Published on 2012-12-09T04:52:20Z Indexed on 2012/12/09 5:04 UTC
Read the original article Hit count: 132

Filed under:
|

For containers such as std::map< std::string, std::unique_ptr< Foo >>, it looks like emplace() has yet to be implemented in stdc++ as of gcc 4.7.2.

Unfortunately, I can't store Foo directly by value as it is an abstract super-class.

As a simple, but inefficient, place-holder, I've just been using std::map< std::string, Foo* > in conjunction with a std::vector< std::unique_ptr< Foo >> for garbage collection.

Do you have a interim solution that is more efficient and more easily replaced once emplace() is available?

© Stack Overflow or respective owner

Related posts about stl

Related posts about c++11