Avoid copying in ranged for loops
New toolchain complains about this, and it's not on purpose.
Change-Id: I5e86f9ba46bc5232831df93718196712eaba89c0
Signed-off-by: Brian Silverman <bsilver16834@gmail.com>
diff --git a/aos/events/simulated_event_loop_test.cc b/aos/events/simulated_event_loop_test.cc
index 277e783..a94b895 100644
--- a/aos/events/simulated_event_loop_test.cc
+++ b/aos/events/simulated_event_loop_test.cc
@@ -2134,7 +2134,7 @@
// Build up the list of all the messages we expect when we come back.
{
std::set<const aos::Channel *> statistics_channels;
- for (const std::pair<std::string_view, const Node *> pi :
+ for (const std::pair<std::string_view, const Node *> &pi :
std::vector<std::pair<std::string_view, const Node *>>{
{"/pi1/aos", pi1->node()},
{"/pi2/aos", pi1->node()},
@@ -2171,7 +2171,7 @@
// forwarded, mainly the timestamp message.
{
std::set<const aos::Channel *> statistics_channels;
- for (const std::pair<std::string_view, const Node *> pi :
+ for (const std::pair<std::string_view, const Node *> &pi :
std::vector<std::pair<std::string_view, const Node *>>{
{"/pi1/aos", pi1->node()}, {"/pi3/aos", pi1->node()}}) {
statistics_channels.insert(configuration::GetChannel(
@@ -2202,7 +2202,7 @@
{
std::set<const aos::Channel *> statistics_channels;
- for (const std::pair<std::string_view, const Node *> pi :
+ for (const std::pair<std::string_view, const Node *> &pi :
std::vector<std::pair<std::string_view, const Node *>>{
{"/pi1/aos", pi1->node()}, {"/pi3/aos", pi1->node()}}) {
statistics_channels.insert(configuration::GetChannel(
diff --git a/y2018/control_loops/superstructure/arm/trajectory.cc b/y2018/control_loops/superstructure/arm/trajectory.cc
index bd67ce3..c6e09dd 100644
--- a/y2018/control_loops/superstructure/arm/trajectory.cc
+++ b/y2018/control_loops/superstructure/arm/trajectory.cc
@@ -130,7 +130,7 @@
// Loop through all the various vmin, plan_vmax combinations.
for (const double c : {-plan_vmax, plan_vmax}) {
// Also loop through saturating theta0 and theta1
- for (const ::std::tuple<double, double, double> abgravity :
+ for (const ::std::tuple<double, double, double> &abgravity :
{::std::tuple<double, double, double>{vk1(0), vk2(0),
gravity_volts(0)},
::std::tuple<double, double, double>{vk1(1), vk2(1),
@@ -201,7 +201,7 @@
double goal_acceleration = -::std::numeric_limits<double>::infinity();
for (double c : {-plan_vmax, plan_vmax}) {
- for (const ::std::pair<double, double> ab :
+ for (const ::std::pair<double, double> &ab :
{::std::pair<double, double>{k_constant(0, 0), k_scalar(0, 0)},
::std::pair<double, double>{k_constant(1, 0), k_scalar(1, 0)}}) {
const double a = ab.first;
@@ -259,7 +259,7 @@
double goal_acceleration = -::std::numeric_limits<double>::infinity();
for (double c : {-plan_vmax, plan_vmax}) {
- for (const ::std::pair<double, double> ab :
+ for (const ::std::pair<double, double> &ab :
{::std::pair<double, double>{k_constant(0, 0), k_scalar(0, 0)},
::std::pair<double, double>{k_constant(1, 0), k_scalar(1, 0)}}) {
const double a = ab.first;