|
Boost : |
Subject: [boost] [move] You can do it better: implementing push_back and handling implicit conversions
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2011-03-08 16:57:19
Hi to all,
Are you a C++ expert? Do you like Boost.Move? I have a challenge for you.
During Boost.Move review, Jeffrey Lee Hellrung suggested adding
"techniques to capture (implicitly created) rvalues with emulated rvalue
references in C++03, e.g., for push_back, when you have knowledge of the
types of objects you want to capture".
I've worked on this problem these days and the solution is less than
obvious (several compilers have has problems with
::boost::is_convertible and non-copyable types). I found a solution
(attached test and required boost/move/move.hpp header) after several
tries but it's complex (it needs several overloads and enable_if tricks)
but I'm sure boosters will find a easier solution ;-)
Current solution seems to work on these compilers: MSVC 7.1, 8.0, 9.0,
Intel 11.0, GCC 4.3.4, 4.4, 4.4 c++0x mode, 4.5, 4.5 c++0x mode.
Problem: MSVC 10.0 (Visual 2010) with real rvalue references seems to
have bugs and does not compile the test. I can't find a workaround, a
future Service Pack might solve these errors, but maybe we should stick
to emulation code in this compiler, unless someone could shed some light
on this, of course.
Waiting your proposals,
Ion
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk