pass by value (#224)

This commit is contained in:
Hans Dembinski 2019-09-29 10:47:56 +02:00 committed by GitHub
parent 62a13a4103
commit bfa7edd5db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,8 +146,8 @@ struct step_type {
Helper function to mark argument as step size. Helper function to mark argument as step size.
*/ */
template <typename T> template <typename T>
auto step(T&& t) { step_type<T> step(T t) {
return step_type<T&&>{std::forward<T>(t)}; return step_type<T>{t};
} }
/** /**
@ -248,8 +248,8 @@ public:
* (start + n * step). * (start + n * step).
*/ */
template <class T> template <class T>
regular(transform_type trans, const step_type<T>& step, value_type start, regular(transform_type trans, step_type<T> step, value_type start, value_type stop,
value_type stop, metadata_type meta = {}) metadata_type meta = {})
: regular(trans, static_cast<index_type>(std::abs(stop - start) / step.value), : regular(trans, static_cast<index_type>(std::abs(stop - start) / step.value),
start, start,
start + static_cast<index_type>(std::abs(stop - start) / step.value) * start + static_cast<index_type>(std::abs(stop - start) / step.value) *
@ -268,8 +268,7 @@ public:
* (start + n * step). * (start + n * step).
*/ */
template <class T> template <class T>
regular(const step_type<T>& step, value_type start, value_type stop, regular(step_type<T> step, value_type start, value_type stop, metadata_type meta = {})
metadata_type meta = {})
: regular({}, step, start, stop, std::move(meta)) {} : regular({}, step, start, stop, std::move(meta)) {}
/// Constructor used by algorithm::reduce to shrink and rebin (not for users). /// Constructor used by algorithm::reduce to shrink and rebin (not for users).