int operator()(int a) { return a; } }; } TEST_CASE("starmap: works with function pointer and lambda", "[starmap]") { using Vec = const std::vector<int>; const std::vector<std::pair<double, int>> v1 = {{1l, 2}, {3l, 11}, {6l, 7}}; Vec vc = {2l, 33l, 42l}; std::vector<int> v; SECTION("with function") { SECTION("Normal call") { auto sm = starmap(f, v1); v.assign(std::begin(sm), std::end(sm)); } SECTION("pipe") { auto sm = v1 | starmap(f); v.assign(std::begin(sm), std::end(sm)); } } SECTION("with lambda") { auto sm = starmap([](long a, int b) { return a * b; }, v1); v.assign(std::begin(sm), std::end(sm)); } REQUIRE(v == vc); }