I can confirm that this is a problem with GCC 4.4.5. Attempting to insert unique_ptr in std :: set results in a long compiler error message, which indicates that some function in STL tried to copy unique_ptr:
error: remote function [unique_ptr copy ctor] ... is used here [g ++ - v4 / bit / stl_tree.h: 136].
The STL function in question is part of the internal tree structure of several STL classes, including std :: set. It is also in the ifdef file "__GXX_EXPERIMENTAL_CXX0X__", which supposedly means that GCC 4.4 does not officially support what we are trying to do.
If you do not want to upgrade to GCC 4.6, you can always wrap std :: vector and strategically check and remove duplicates at specific points in your code.
source share