Skip to content
Snippets Groups Projects
Commit a392e029 authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Merge branch 'feature/extend-stdapplytest' into 'master'

[test] Check Std::apply() by implementing a tuple transformation

This checks with a real application example: An implementation
of a tuple transformation.

Maybe we also want to implement our real tuple tranformation
that way, because its easier to read and much shorter.

See merge request !171
parents 9e63c2bd 9e3027e5
No related branches found
No related tags found
No related merge requests found
......@@ -46,6 +46,17 @@ int main()
test.check(std::get<0>(intTuple) == intTuple0) << "Dune::Std::apply does not properly return references";
// transformTuple implemented using Std::apply
auto transformTuple = [](auto&& t, auto&& f) {
return Dune::Std::apply([&](auto&&... args) {
return std::make_tuple((f(std::forward<decltype(args)>(args)))...);
}, t);
};
auto t1 = std::make_tuple(1, 0.2);
auto t2 = transformTuple(t1, [](auto&& x) { return 1.0/x; });
test.check(t2 == std::make_tuple(1.0, 5.0)) << "transformTuple implementation based on Dune::Std::apply fails";
return test.exit();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment