From 91fb084a2be5003dfd9ffed977f4f8a4c166775f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Gr=C3=A4ser?= <graeser@dune-project.org> Date: Fri, 4 Nov 2016 21:51:14 +0100 Subject: [PATCH] [doc] Add some more documentation to implementation --- dune/common/overloadset.hh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dune/common/overloadset.hh b/dune/common/overloadset.hh index 4f0aaf663..0c1b83126 100644 --- a/dune/common/overloadset.hh +++ b/dune/common/overloadset.hh @@ -30,6 +30,7 @@ namespace Impl { F0(std::forward<FF0>(f0)) {} + // pull in operator() of F0 and of all F... via the base class using F0::operator(); using Base::operator(); }; @@ -44,6 +45,7 @@ namespace Impl { F0(std::forward<FF0>(f0)) {} + // pull in operator() of F0 using F0::operator(); }; @@ -95,6 +97,7 @@ namespace Impl { F0(std::forward<FF0>(f0)) {} + // Forward to operator() of F0 if it can be called with the given arguments. template<class... Args, std::enable_if_t<Std::is_callable<F0(Args&&...)>::value, int> = 0> decltype(auto) operator()(Args&&... args) @@ -102,6 +105,9 @@ namespace Impl { return F0::operator()(std::forward<Args>(args)...); } + // Forward to operator() of base class if F0 cannot be called with the given + // arguments. In this case the base class will successively try operator() + // of all F... . template<class... Args, std::enable_if_t< not Std::is_callable<F0(Args&&...)>::value, int> = 0> decltype(auto) operator()(Args&&... args) @@ -121,6 +127,8 @@ namespace Impl { F0(std::forward<FF0>(f0)) {} + // Forward to operator() of F0. If it cannot be called with + // the given arguments a static assertion will fail. template<class... Args> decltype(auto) operator()(Args&&... args) { -- GitLab