Commit 56291f47 authored by Laith Sakka's avatar Laith Sakka Committed by Facebook GitHub Bot

use forwarding reference for ReferencedSource range loop item

Summary:
When the elements in the containers are r-value references, or const l-value references, ReferencedSource fail to forward them.

This update generalize the interface to make it work for all type of references.

Reviewed By: ot, philippv

Differential Revision: D32807312

fbshipit-source-id: ec006aefd733e7f7fbf097a09b7cd50605ab0c9d
parent 87e591be
......@@ -135,14 +135,14 @@ class ReferencedSource
template <class Body>
void foreach(Body&& body) const {
for (auto& value : *container_) {
for (auto&& value : *container_) {
body(std::forward<Value>(value));
}
}
template <class Handler>
bool apply(Handler&& handler) const {
for (auto& value : *container_) {
for (auto&& value : *container_) {
if (!handler(std::forward<Value>(value))) {
return false;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment