Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reindent.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 13 Apr 2018 20:55:30 +0000 (22:55 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 16 Apr 2018 08:15:49 +0000 (10:15 +0200)
src/smpi/internals/smpi_replay.cpp

index 4744eda..e9ad914 100644 (file)
 // From https://stackoverflow.com/questions/7110301/generic-hash-for-tuples-in-unordered-map-unordered-set
 // This is all just to make std::unordered_map work with std::tuple. If we need this in other places,
 // this could go into a header file.
 // From https://stackoverflow.com/questions/7110301/generic-hash-for-tuples-in-unordered-map-unordered-set
 // This is all just to make std::unordered_map work with std::tuple. If we need this in other places,
 // this could go into a header file.
-namespace hash_tuple{
-    template <typename TT>
-    class hash
-    {
-    public:
-        size_t
-        operator()(TT const& tt) const
-        {
-            return std::hash<TT>()(tt);
-        }
-    };
+namespace hash_tuple {
+template <typename TT> class hash {
+public:
+  size_t operator()(TT const& tt) const { return std::hash<TT>()(tt); }
+};
 
 
-    template <class T>
-    inline void hash_combine(std::size_t& seed, T const& v)
-    {
-        seed ^= hash_tuple::hash<T>()(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
-    }
+template <class T> inline void hash_combine(std::size_t& seed, T const& v)
+{
+  seed ^= hash_tuple::hash<T>()(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
+}
 
 
-    // Recursive template code derived from Matthieu M.
-    template <class Tuple, size_t Index = std::tuple_size<Tuple>::value - 1>
-    class HashValueImpl
-    {
-    public:
-      static void apply(size_t& seed, Tuple const& tuple)
-      {
-        HashValueImpl<Tuple, Index-1>::apply(seed, tuple);
-        hash_combine(seed, std::get<Index>(tuple));
-      }
-    };
+// Recursive template code derived from Matthieu M.
+template <class Tuple, size_t Index = std::tuple_size<Tuple>::value - 1> class HashValueImpl {
+public:
+  static void apply(size_t& seed, Tuple const& tuple)
+  {
+    HashValueImpl<Tuple, Index - 1>::apply(seed, tuple);
+    hash_combine(seed, std::get<Index>(tuple));
+  }
+};
 
 
-    template <class Tuple>
-    class HashValueImpl<Tuple,0>
-    {
-    public:
-      static void apply(size_t& seed, Tuple const& tuple)
-      {
-        hash_combine(seed, std::get<0>(tuple));
-      }
-    };
+template <class Tuple> class HashValueImpl<Tuple, 0> {
+public:
+  static void apply(size_t& seed, Tuple const& tuple) { hash_combine(seed, std::get<0>(tuple)); }
+};
 
 
-    template <typename ... TT>
-    class hash<std::tuple<TT...>>
-    {
-    public:
-        size_t
-        operator()(std::tuple<TT...> const& tt) const
-        {
-            size_t seed = 0;
-            HashValueImpl<std::tuple<TT...> >::apply(seed, tt);
-            return seed;
-        }
-    };
+template <typename... TT> class hash<std::tuple<TT...>> {
+public:
+  size_t operator()(std::tuple<TT...> const& tt) const
+  {
+    size_t seed = 0;
+    HashValueImpl<std::tuple<TT...>>::apply(seed, tt);
+    return seed;
+  }
+};
 }
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_replay,smpi,"Trace Replay with SMPI");
 }
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_replay,smpi,"Trace Replay with SMPI");