Opened 14 years ago
Closed 5 years ago
#474 closed request (fixed)
create Vector from temporary VectorView fails
Reported by: | Peter | Owned by: | Peter |
---|---|---|---|
Priority: | major | Milestone: | yat 0.15 |
Component: | utility | Version: | trunk |
Keywords: | Cc: |
Description
This code does not compile
utility::Matrix m(10,3); utility::Vector v2(m.row_view(1));
Change History (18)
comment:1 Changed 14 years ago by
Milestone: | yat 0.5 |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
comment:2 Changed 14 years ago by
I meant
utility::Matrix m(10,3); utility::Vector v2(m.row_const_view(1));
comment:3 Changed 13 years ago by
Milestone: | → yat 0.x+ |
---|---|
Resolution: | wontfix |
Status: | closed → reopened |
Similarily:
Matrix result(10,10, 0.0); Matrix m(10,10, 1.0); utility::VectorView vv=result.column_view(2); vv=m.column_view(3);
does not compile. Likewise to mentioned above a workaround would be
Matrix result(10,10, 0.0); Matrix m(10,10, 1.0); utility::VectorView vv=result.column_view(2); vv=m.column_const_view(3);
This ticket should not be closed though because it is a severe weakness.
comment:4 Changed 13 years ago by
Status: | reopened → new |
---|
This problem could be avoided with the new rvalue semantics that will be included in the C++0x standard as described here.
This feature is included in gcc 4.3, so one could solve this for users using gcc 4.3 or later, but since I'm sitting with 4.1 I won't be able to implement that in the near future. Also, I'm not sure it's wise to fork the library like that.
comment:6 Changed 13 years ago by
comment:7 Changed 13 years ago by
Having this working, we should perhaps add implicit conversion from VectorView? to VectorConstView? (as discussed in #467).
comment:8 Changed 10 years ago by
Boost.Move provides macros to write move construction/assignment for both c++03 and c++11 compilers.
comment:9 Changed 10 years ago by
Milestone: | yat 0.x+ → yat 0.10 |
---|
I suggest we implement move construction/assignment for at least Matrix and Vector classes.
comment:10 Changed 10 years ago by
Status: | new → assigned |
---|
comment:11 Changed 10 years ago by
Milestone: | yat 0.10 → yat 0.x+ |
---|---|
Status: | assigned → new |
Type: | defect → request |
Boost.Move was introduced in boost-1.48 which was released 2011-11-15. I'm reluctant to introducing a dependency to such as recent version. Both RHEL6 and CentOS6, for example, distribute Boost-1.41.
comment:12 Changed 9 years ago by
It struck me that we could implement this conditionally i.e. only implement if boost 1.48 (or newer) is available. One could also implement if compiler is modern enough. Or combine these option in:
#if this do this #elif that do that #else do nothing #endif
Not sure in which order to pick things, but my gut feeling is that one should implement clean without boost if compiler supports it, otherwise use boost if boost is available, else skip. Note, that boost itself does some selection based on used compiler.
comment:13 Changed 5 years ago by
It is perhaps time to upgrade required boost version, so we can look at this.
comment:15 Changed 5 years ago by
Milestone: | yat 0.x+ → yat 0.15 |
---|
comment:17 Changed 5 years ago by
comment:18 Changed 5 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [3595]) implicit conversion from VectorView? to VectorConstView?. closes #474
Hm, this is a documented weakness. Use
to achieve the desired result.