Opened 13 years ago
Last modified 13 years ago
#3457 new Feature Requests
introduce move semantics to container types
Reported by: | Gunter | Owned by: | Gunter |
---|---|---|---|
Milestone: | Boost 1.41.0 | Component: | uBLAS |
Version: | Boost 1.40.0 | Severity: | Optimization |
Keywords: | Cc: |
Description
I am writing many routines where I would strongly prefer: matrix<double> f(const matrix<double>& in)
to
void f(const matrix<double>& in, matrix<double>& out )
There has been a lot of discussion about this from the C++ groups:
- The move library to support this in C++03
- http://cpp-next.com/archive/2009/08/want-speed-pass-by-value/
Also, I see that this is native to MTL: http://www.osl.iu.edu/research/mtl/mtl4/doc/matrix_assignment.html#move_semantics
Change History (5)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
comment:3 by , 13 years ago
Because for the bounded and c types, the move semantics don't have any effect, I think they should be disabled for now for those types, so that they don't promise something that they don't do.
Also in the options.htm, I would propose the description to read:
An immediate effect of this option is the elimination of the need for noalias in types <tt>vector<T></tt> and <tt>matrix<T></tt>, when assigned to the same type. This option doesn't have an effect on bounded and c types. Although it is rare, not all compilers support copy elision (that allows for move semantics), so a test must be performed to make sure that there is a benefit when it is enabled. A small demonstration and test can be found in test/manual/test_move_semantics.cpp
(In [56248]) see #3457