From 6215a88d9b95143e9067b8068ee3d335873633f1 Mon Sep 17 00:00:00 2001 From: Yedidya Feldblum Date: Tue, 12 Jul 2016 15:26:39 -0700 Subject: [PATCH] Fix Build: sorted_vector_types.h on GCC v4.8 Summary: [Folly] Fix Build: `sorted_vector_types.h` on GCC v4.8. Problem: that compiler does not yet support `auto`-typed lambda parameters. Solution: specify the types of the lambda parameters. Reviewed By: mzlee, Orvid Differential Revision: D3551262 fbshipit-source-id: 160d3245ec422060175ce59ee653d158954477ed --- folly/sorted_vector_types.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/folly/sorted_vector_types.h b/folly/sorted_vector_types.h index aa2f0420..df826299 100644 --- a/folly/sorted_vector_types.h +++ b/folly/sorted_vector_types.h @@ -573,25 +573,33 @@ public: iterator lower_bound(const key_type& key) { auto c = key_comp(); - auto f = [&](const auto& a, const auto& b) { return c(a.first, b); }; + auto f = [&](const value_type& a, const key_type& b) { + return c(a.first, b); + }; return std::lower_bound(begin(), end(), key, f); } const_iterator lower_bound(const key_type& key) const { auto c = key_comp(); - auto f = [&](const auto& a, const auto& b) { return c(a.first, b); }; + auto f = [&](const value_type& a, const key_type& b) { + return c(a.first, b); + }; return std::lower_bound(begin(), end(), key, f); } iterator upper_bound(const key_type& key) { auto c = key_comp(); - auto f = [&](const auto& a, const auto& b) { return c(a, b.first); }; + auto f = [&](const key_type& a, const value_type& b) { + return c(a, b.first); + }; return std::upper_bound(begin(), end(), key, f); } const_iterator upper_bound(const key_type& key) const { auto c = key_comp(); - auto f = [&](const auto& a, const auto& b) { return c(a, b.first); }; + auto f = [&](const key_type& a, const value_type& b) { + return c(a, b.first); + }; return std::upper_bound(begin(), end(), key, f); } @@ -601,7 +609,9 @@ public: // have to do this. iterator low = lower_bound(key); auto c = key_comp(); - auto f = [&](const auto& a, const auto& b) { return c(a, b.first); }; + auto f = [&](const key_type& a, const value_type& b) { + return c(a, b.first); + }; iterator high = std::upper_bound(low, end(), key, f); return std::make_pair(low, high); } -- 2.34.1