|
Boost Users : |
Subject: [Boost-users] Boost.Move BOOST_MOVABLE_BUT_NOT_COPYABLE macro
From: luke (lukeallardyce_at_[hidden])
Date: 2013-02-13 00:36:46
Due to GCC 4.7.2 and lower not supporting a change in template deduction rules as explained in the answer below
http://stackoverflow.com/questions/14808663/stdunordered-mapemplace-issue-with-private-deleted-copy-constructor/14836911#14836911
the following code will not compile:
#include <utility>
class test
{
public:
test() =default;
private:
test(test const&);
};
int main()
{
std::is_convertible<test&, test>::value;
};
For the same reason, it is not possible to use classes which use the BOOST_MOVABLE_BUT_NOT_COPYABLE in situations where libstdc++ uses std::is_convertible, for instance when using piecewise construction in std::unordered_map::emplace() (I came across the issue when making an unordered_map of boost::file_mapping)
As deleting the copy constructor fixes the issue (i.e. test(test const&) =delete;), would it be at all possible for BOOST_MOVABLE_BUT_NOT_COPYABLE to do the same for compilers that support the syntax?
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