C++ unique_ptr and map

前端 未结 4 1968
抹茶落季
抹茶落季 2020-12-13 19:19

I\'m trying to use the C++0x unique_ptr class inside a map like so:

// compile with `g++ main.cpp -std=gnu++0x`

#include     
#include 

        
4条回答
  •  一生所求
    2020-12-13 20:02

    I don't believe it's possible to correctly use unique_ptr in a map::insert yet. Here's the GCC bug for it:

    Bug 44436 - [C++0x] Implement insert(&&) and emplace* in associative and unordered containers

    It looks like it may be fixed for GCC 4.6, but it won't build from SVN on vanilla Ubuntu 10.04.1 to confirm.

    Update0

    This is not working as of GCC svn r165422 (4.6.0).

提交回复
热议问题