-
Notifications
You must be signed in to change notification settings - Fork 144
Open
Milestone
Description
See:
| grid( DataSet1&& ds1, DataSet2&& ds2 ) |
Which boils down to
template<typename DataSet1, typename DataSet2>
class grid {
//! Constructor
grid( DataSet1&& ds1, DataSet2&& ds2 )
: m_ds1( std::forward<DataSet1>( ds1 ) )
, m_ds2( std::forward<DataSet2>( ds2 ) )
{}
};Here DataSet1 and DataSet2, while template parameters to the class, are not template parameters to the function.
As a result, this formulation of the constructor always takes these two parameters as rvalue-reference.
This can be corrected in 3 ways
- Take both parameters by value
- Make the constructor a template function
- Make additional constructors that represent the cross-product of const& and && for each parameter. In this case, resulting in 4 functions.
I see that this same mistake is done in more than one place, it's not only grid.hpp where it happens.
Metadata
Metadata
Assignees
Labels
No labels