Merge branch release-2021
[alexxy/gromacs.git] / api / nblib / listed_forces / transformations.cpp
index fc039575937f7c186ed2ac34cde3157e1ea3f67c..f6e92ac86864b7fb1b149e01c0601d24c2cda6ca 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2020, by the GROMACS development team, led by
+ * Copyright (c) 2020,2021, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
  */
 #include "nblib/listed_forces/transformations.h"
 
-#include "nblib/util/internal.h"
+#include "nblib/util/util.hpp"
 
 namespace nblib
 {
 
 void sortInteractions(ListedInteractionData& interactions)
 {
-    auto sortKeyObj = [](const auto& lhs, const auto& rhs) { return interactionSortKey(lhs, rhs); };
-    auto sortOneElement = [comparison = sortKeyObj](auto& interactionElement) {
-        std::sort(begin(interactionElement.indices), end(interactionElement.indices), comparison);
+    auto sortOneElement = [](auto& interactionElement) {
+        using InteractionContainerType = std::decay_t<decltype(interactionElement)>;
+        using InteractionType          = typename InteractionContainerType::type;
+
+        std::sort(begin(interactionElement.indices),
+                  end(interactionElement.indices),
+                  interactionSortKey<InteractionType>);
     };
 
     for_each_tuple(sortOneElement, interactions);