[fusion] move-enabled containers?

Hi folks, I have been starting to ease into C++11, and am currently looking to add move-awareness to some classes which have members of boost::fusion container types. However, it seems that fusion containers are not move-aware. For a minimal example, take the code below: ========== #include <boost/fusion/include/vector.hpp> #include <iostream> class noisy { public: noisy() { std::cout << "noisy()\n"; } noisy(const noisy&) { std::cout << "noisy(const noisy&)\n"; } noisy(noisy&&) { std::cout << "noisy(noisy&&)\n"; } }; int main() { typedef boost::fusion::vector<noisy, noisy> noisyVector; noisyVector n; std::cout << '\n'; noisyVector n2(n); std::cout << '\n'; noisyVector n3(std::move(n)); } ========== I was hoping that the output would be: ========== noisy() noisy() noisy(const noisy&) noisy(const noisy&) noisy(noisy&&) noisy(noisy&&) ========== But instead I get: ========== noisy() noisy() noisy(const noisy&) noisy(const noisy&) noisy(const noisy&) noisy(const noisy&) ========== It is a simple matter to add move-awareness to fusion containers, or is there some technical reason why it cannot been done? Or (perhaps more likely), am I misunderstanding something about the situation? Thanks, -Gabe

On 20/08/2012 19:53, Gabriel Redner wrote:
It is a simple matter to add move-awareness to fusion containers, or is there some technical reason why it cannot been done? Or (perhaps more likely), am I misunderstanding something about the situation?
I had written a patch that made fusion::vector move-aware quite some time ago. It was never included because supposedly there was a big C++11 rewrite of fusion coming up. But it seems it's not going to be released any time soon. Maybe a simple patch to make the containers aware would be better for now.

I, for one, would welcome any progress (even incremental) on this front. There's always a big rewrite on the horizon, but that doesn't mean that simple changes which improve things in the meantime should not be incorporated! Is there a bug associated with this patch? I'd be interested in trying it out. Thanks, -Gabe On Mon, Aug 20, 2012 at 4:01 PM, Mathias Gaunard <mathias.gaunard@ens-lyon.org> wrote:
On 20/08/2012 19:53, Gabriel Redner wrote:
It is a simple matter to add move-awareness to fusion containers, or is there some technical reason why it cannot been done? Or (perhaps more likely), am I misunderstanding something about the situation?
I had written a patch that made fusion::vector move-aware quite some time ago. It was never included because supposedly there was a big C++11 rewrite of fusion coming up. But it seems it's not going to be released any time soon.
Maybe a simple patch to make the containers aware would be better for now.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Mathias Gaunard <mathias.gaunard@ens-lyon.org> writes:
On 20/08/2012 19:53, Gabriel Redner wrote:
It is a simple matter to add move-awareness to fusion containers, or is there some technical reason why it cannot been done? Or (perhaps more likely), am I misunderstanding something about the situation?
I had written a patch that made fusion::vector move-aware quite some time ago. It was never included because supposedly there was a big C++11 rewrite of fusion coming up. But it seems it's not going to be released any time soon.
Eventually the rewrite became a fork that does not want to be part of either Boost or Boost.Fusion. The current codebase[1] is pretty much source compatible, convertible and adaptable from/to Boost.Fusion/Boost.MPL. On topic: you can easily implement your own move-aware container and adapt it via the extension facility. Christopher [1] http://ch.ristopher.com/git/?p=slim;a=summary

On 8/21/2012 4:45 AM, Christopher Schmidt wrote:
Mathias Gaunard <mathias.gaunard@ens-lyon.org> writes:
On 20/08/2012 19:53, Gabriel Redner wrote:
It is a simple matter to add move-awareness to fusion containers, or is there some technical reason why it cannot been done? Or (perhaps more likely), am I misunderstanding something about the situation?
I had written a patch that made fusion::vector move-aware quite some time ago. It was never included because supposedly there was a big C++11 rewrite of fusion coming up. But it seems it's not going to be released any time soon.
Eventually the rewrite became a fork that does not want to be part of either Boost or Boost.Fusion. The current codebase[1] is pretty much source compatible, convertible and adaptable from/to Boost.Fusion/Boost.MPL.
On topic: you can easily implement your own move-aware container and adapt it via the extension facility.
I still welcome a merger; as long as it is a merger and not a complete overhaul. Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com

On 8/21/2012 4:01 AM, Mathias Gaunard wrote:
On 20/08/2012 19:53, Gabriel Redner wrote:
It is a simple matter to add move-awareness to fusion containers, or is there some technical reason why it cannot been done? Or (perhaps more likely), am I misunderstanding something about the situation?
I had written a patch that made fusion::vector move-aware quite some time ago. It was never included because supposedly there was a big C++11 rewrite of fusion coming up. But it seems it's not going to be released any time soon.
Maybe a simple patch to make the containers aware would be better for now.
It's at the top of my list of things that should be done. Yes, it is a simple matter to add move-awareness. I'd welcome incremental patches. Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com
participants (4)
-
Christopher Schmidt
-
Gabriel Redner
-
Joel de Guzman
-
Mathias Gaunard