Add perfect forwarding to make_iterator calls (#3860)

This commit is contained in:
Aaron Gokaslan 2022-04-11 14:03:43 -04:00 committed by GitHub
parent 1b27b744c1
commit e3aa215b02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2403,7 +2403,8 @@ template <return_value_policy Policy = return_value_policy::reference_internal,
typename Type, typename Type,
typename... Extra> typename... Extra>
iterator make_iterator(Type &value, Extra &&...extra) { iterator make_iterator(Type &value, Extra &&...extra) {
return make_iterator<Policy>(std::begin(value), std::end(value), extra...); return make_iterator<Policy>(
std::begin(value), std::end(value), std::forward<Extra>(extra)...);
} }
/// Makes an iterator over the keys (`.first`) of a stl map-like container supporting /// Makes an iterator over the keys (`.first`) of a stl map-like container supporting
@ -2412,7 +2413,8 @@ template <return_value_policy Policy = return_value_policy::reference_internal,
typename Type, typename Type,
typename... Extra> typename... Extra>
iterator make_key_iterator(Type &value, Extra &&...extra) { iterator make_key_iterator(Type &value, Extra &&...extra) {
return make_key_iterator<Policy>(std::begin(value), std::end(value), extra...); return make_key_iterator<Policy>(
std::begin(value), std::end(value), std::forward<Extra>(extra)...);
} }
/// Makes an iterator over the values (`.second`) of a stl map-like container supporting /// Makes an iterator over the values (`.second`) of a stl map-like container supporting
@ -2421,7 +2423,8 @@ template <return_value_policy Policy = return_value_policy::reference_internal,
typename Type, typename Type,
typename... Extra> typename... Extra>
iterator make_value_iterator(Type &value, Extra &&...extra) { iterator make_value_iterator(Type &value, Extra &&...extra) {
return make_value_iterator<Policy>(std::begin(value), std::end(value), extra...); return make_value_iterator<Policy>(
std::begin(value), std::end(value), std::forward<Extra>(extra)...);
} }
template <typename InputType, typename OutputType> template <typename InputType, typename OutputType>