|
Boost Users : |
Subject: [Boost-users] Is it possible to put a std::unique_ptr into a mulit_index container?
From: Josh Quigley (0zeroth_at_[hidden])
Date: 2012-10-24 04:22:18
Hi all,
Is it possible to put a std::unique_ptr into a mulit_index container?
In particular, the following fails.
typedef std::pair<int, std::unique_ptr<int> > ValueT;
typedef boost::multi_index_container<
ValueT,
boost::multi_index::indexed_by<
boost::multi_index::hashed_unique<
BOOST_MULTI_INDEX_MEMBER(ValueT, int, first)
>
>
> HashMap;
HashMap map;
auto a = std::make_pair(5, std::unique_ptr<int>(new int(5)));
map.insert(std::move(b)); // This line fails to compile
(Visual Studio 2012)
I'm guessing the answer is 'No' and it's because the rvalue reference
overloads have not been done, but I'd like confirmation (or even
better, to be told I'm wrong!).
Thanks,
Josh.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net