From: Peter Griess Date: Thu, 26 Sep 2013 15:05:57 +0000 (-0500) Subject: Cast lambda to function pointer for boost::split(). X-Git-Tag: v0.22.0~830 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=443652777459d54c8cb5eac1c49d19b7a2218e6a;p=folly.git Cast lambda to function pointer for boost::split(). Summary: - For some reason, Boost's internals aren't considering this lambda a type that's castable. Cast it to a function pointer before using it. Test Plan: - fbconfig -r folly && fbmake runtests - ./configure && make check on Ubuntu/FC/Mac - _bin/folly/test/string_test --benchmark Reviewed By: alandau@fb.com FB internal diff: D998594 --- diff --git a/folly/test/StringTest.cpp b/folly/test/StringTest.cpp index aac79a8a..c48c4059 100644 --- a/folly/test/StringTest.cpp +++ b/folly/test/StringTest.cpp @@ -965,9 +965,10 @@ BENCHMARK(splitStrFixed, iters) { BENCHMARK(boost_splitOnSingleChar, iters) { static const std::string line = "one:two:three:four"; + bool(*pred)(char) = [] (char c) -> bool { return c == ':'; }; for (int i = 0; i < iters << 4; ++i) { std::vector > pieces; - boost::split(pieces, line, [] (char c) { return c == ':'; }); + boost::split(pieces, line, pred); } }