Make dispatchTemplatedFunction compatible with MSVC
authorAndrey Alekseenko <al42and@gmail.com>
Wed, 28 Oct 2020 12:34:20 +0000 (13:34 +0100)
committerAndrey Alekseenko <al42and@gmail.com>
Wed, 28 Oct 2020 12:34:20 +0000 (13:34 +0100)
MR !730 introduced a new function, dispatchTemplatedFunction, which
broke build with MSVC 19.27. Looks like a compiler problem, but the fix
is easy enough (and, arguably, makes the code a bit easier to read).

src/gromacs/utility/template_mp.h

index 2f512a998dc6175078cfbfea50bb84f982feb3b1..14b4f5371d4896ae07259029523cf672a203f016 100644 (file)
@@ -89,10 +89,10 @@ template<class Function, class Enum, class... Enums>
 auto dispatchTemplatedFunction(Function&& f, Enum e, Enums... es)
 {
     return dispatchTemplatedFunction(
-            [&](auto... es) {
-                return compat::mp_with_index<size_t(Enum::Count)>(size_t(e), [&](auto e) {
+            [&](auto... es_) {
+                return compat::mp_with_index<size_t(Enum::Count)>(size_t(e), [&](auto e_) {
                     return std::forward<Function>(f)(
-                            std::integral_constant<Enum, static_cast<Enum>(size_t(e))>(), es...);
+                            std::integral_constant<Enum, static_cast<Enum>(size_t(e_))>(), es_...);
                 });
             },
             es...);