|
Boost : |
Subject: [boost] [move] interest: the pass-by-value and swap idiom, and explicit copy constructors
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2014-02-14 11:52:53
Hello,
I would like to ask about interest in an idea of mine. I described it in
detail [1] and implemented it as part of my cz libraries [2].
In short, the idea presents:
- an alternative to implicitly copyable and movable types: making them
explicitly copyable;
- a protocol for explicitly stating in code, where a copy is to be made
(boost::copy()), which compliments the protocol for explicitly stating in
code, where a move is allowed (std::move() or boost::move());
- a Boost.move extension for implementing movable types with use of the
pass-by-value and swap idiom, backwards-compatible with C++98, which allows
to choose copying policies (and eases changing between these policies
during maintenance):
- movable but not copyable,
- movable and explicitly-copyable,
- movable and copyable;
- an example, showing how simply a CloneablePtr can thereby be implemented.
This extension to Boost.move is hosted and developed as part of my cz
libraries [2], but it isn't tied to them at all. It only consists of two
headers. I extracted the two headers together with samples and docs, and
they are available as a zip archive [3].
I would be most excited if there was interest in adding this functionality
to Boost.move, but in any case, all comments are much appreciated.
Regards,
Kris
[1] http://kristoczaj.bitbucket.org/cz/copy_move_types.html
[2] http://kristoczaj.bitbucket.org/cz/index.html
[3] http://bitbucket.org/kristoczaj/cz/downloads/move-0.7.1.zip
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk