Wraps a function taking N arguments into a function which accepts a tuple of N arguments. Note: This function will also accept an std::pair if N == 2.

Synopsis

Declared in <folly/functional/ApplyTuple.h>

template<class F>
/* implementation-defined */
uncurry(F&& f);

Description

For example, given the below code:

std::vector<std::tuple<int, int, int>> rows = ...; auto test = []int, int>& row) { return std::get<0>(row) * std::get<1>(row) * std::get<2>(row) == 24; }; auto found = std::find_if(rows.begin(), rows.end(), test);

'test' could be rewritten as:

auto test = folly::uncurry([]a, int b, int c) { return a * b * c == 24; });

Return Value

a callable that unpacks a tuple and forwards its elements to f

Parameters

Name

Description

f

the function to wrap

Created with MrDocs