Commit 21bbc9a9 authored by Lucian Grijincu's avatar Lucian Grijincu Committed by facebook-github-bot-1

folly: gen: remove static member

Summary: there's no need for this static member, but it does get
generated. We're only curious about it's type. Replace with Meyer's
singleton to get the same effect.

Reviewed By: @ddrcoder, @yfeldblum

Differential Revision: D2446131
parent 5a4feee6
......@@ -272,13 +272,9 @@ struct FBounded;
*/
template<class Container>
struct ValueTypeOfRange {
private:
static Container container_;
public:
typedef decltype(*std::begin(container_))
RefType;
typedef typename std::decay<decltype(*std::begin(container_))>::type
StorageType;
using RefType = decltype(*std::begin(std::declval<Container&>()));
using StorageType = typename std::decay<RefType>::type;
};
......
......@@ -203,8 +203,6 @@ class MergeTuples {
} // namespace detail
static const detail::Map<detail::MergeTuples> tuple_flatten{};
// TODO(mcurtiss): support zip() for N>1 operands. Because of variadic problems,
// this might not be easily possible until gcc4.8 is available.
template<class Source,
......
......@@ -30,6 +30,9 @@ using std::string;
using std::vector;
using std::tuple;
const folly::gen::detail::Map<
folly::gen::detail::MergeTuples> gTupleFlatten{};
auto even = [](int i) -> bool { return i % 2 == 0; };
auto odd = [](int i) -> bool { return i % 2 == 1; };
......@@ -118,7 +121,7 @@ TEST(CombineGen, TupleFlatten) {
EXPECT_EQ(std::get<1>(zipped1[0]), std::make_tuple('A'));
auto zipped2 = from(zipped1)
| tuple_flatten
| gTupleFlatten
| assert_type<tuple<int, string, char>&&>()
| as<vector>();
ASSERT_EQ(zipped2.size(), 3);
......@@ -126,7 +129,7 @@ TEST(CombineGen, TupleFlatten) {
auto zipped3 = from(charTupleVec)
| zip(intStringTupleVec)
| tuple_flatten
| gTupleFlatten
| assert_type<tuple<char, int, string>&&>()
| as<vector>();
ASSERT_EQ(zipped3.size(), 3);
......@@ -134,7 +137,7 @@ TEST(CombineGen, TupleFlatten) {
auto zipped4 = from(intStringTupleVec)
| zip(doubleVec)
| tuple_flatten
| gTupleFlatten
| assert_type<tuple<int, string, double>&&>()
| as<vector>();
ASSERT_EQ(zipped4.size(), 3);
......@@ -143,7 +146,7 @@ TEST(CombineGen, TupleFlatten) {
auto zipped5 = from(doubleVec)
| zip(doubleVec)
| assert_type<tuple<double, double>>()
| tuple_flatten // essentially a no-op
| gTupleFlatten // essentially a no-op
| assert_type<tuple<double, double>&&>()
| as<vector>();
ASSERT_EQ(zipped5.size(), 5);
......@@ -151,9 +154,9 @@ TEST(CombineGen, TupleFlatten) {
auto zipped6 = from(intStringTupleVec)
| zip(charTupleVec)
| tuple_flatten
| gTupleFlatten
| zip(doubleVec)
| tuple_flatten
| gTupleFlatten
| assert_type<tuple<int, string, char, double>&&>()
| as<vector>();
ASSERT_EQ(zipped6.size(), 3);
......
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