Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove compatibility layer for pre-c++14.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 2 Oct 2020 19:45:40 +0000 (21:45 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 2 Oct 2020 19:59:04 +0000 (21:59 +0200)
include/simgrid/simix.hpp
include/xbt/functional.hpp
include/xbt/utility.hpp
src/mc/sosp/PageStore.cpp

index 324062c..db2d157 100644 (file)
@@ -11,6 +11,7 @@
 #include <xbt/functional.hpp>
 #include <xbt/future.hpp>
 #include <xbt/signal.hpp>
+#include <xbt/utility.hpp>
 
 #include <boost/heap/fibonacci_heap.hpp>
 #include <string>
index 145e461..e84506f 100644 (file)
@@ -7,7 +7,6 @@
 #define XBT_FUNCTIONAL_HPP
 
 #include <xbt/sysdep.h>
-#include <xbt/utility.hpp>
 
 #include <cstddef>
 #include <cstdlib>
@@ -64,8 +63,8 @@ template <class F> inline std::function<void()> wrap_main(F code, int argc, cons
 
 namespace bits {
 template <class F, class Tuple, std::size_t... I>
-constexpr auto apply(F&& f, Tuple&& t, simgrid::xbt::index_sequence<I...>)
-  -> decltype(std::forward<F>(f)(std::get<I>(std::forward<Tuple>(t))...))
+constexpr auto apply(F&& f, Tuple&& t, std::index_sequence<I...>)
+    -> decltype(std::forward<F>(f)(std::get<I>(std::forward<Tuple>(t))...))
 {
   return std::forward<F>(f)(std::get<I>(std::forward<Tuple>(t))...);
 }
@@ -81,20 +80,13 @@ constexpr auto apply(F&& f, Tuple&& t, simgrid::xbt::index_sequence<I...>)
  *  @endcode
  **/
 template <class F, class Tuple>
-constexpr auto apply(F&& f, Tuple&& t)
-  -> decltype(simgrid::xbt::bits::apply(
-    std::forward<F>(f),
-    std::forward<Tuple>(t),
-    simgrid::xbt::make_index_sequence<
-      std::tuple_size<typename std::decay<Tuple>::type>::value
-    >()))
+constexpr auto apply(F&& f, Tuple&& t) -> decltype(
+    simgrid::xbt::bits::apply(std::forward<F>(f), std::forward<Tuple>(t),
+                              std::make_index_sequence<std::tuple_size<typename std::decay<Tuple>::type>::value>()))
 {
   return simgrid::xbt::bits::apply(
-    std::forward<F>(f),
-    std::forward<Tuple>(t),
-    simgrid::xbt::make_index_sequence<
-      std::tuple_size<typename std::decay<Tuple>::type>::value
-    >());
+      std::forward<F>(f), std::forward<Tuple>(t),
+      std::make_index_sequence<std::tuple_size<typename std::decay<Tuple>::type>::value>());
 }
 
 template<class T> class Task;
index c39cf85..be9d287 100644 (file)
@@ -47,69 +47,6 @@ template <class List, class Elem> inline void intrusive_erase(List& list, Elem&
   list.erase(list.iterator_to(elem));
 }
 
-// integer_sequence and friends from C++14
-// We need them to implement `apply` from C++17.
-
-/** A compile-time sequence of integers (from C++14)
- *
- * `index_sequence<std::size_t,1,5,7,9>` represents the sequence `(1,5,7,9)`.
- *
- * @code{.cpp}
- * template<class T, std::size_t... I>
- * auto extract_tuple(T&& t, integer_sequence<std::size_t, I...>)
- *   -> decltype(std::make_tuple(std::get<I>(std::forward<T>(t))...))
- * {
- *  return std::make_tuple(std::get<I>(std::forward<T>(t))...);
- * }
- *
- * int main()
- * {
- *   integer_sequence<std::size_t, 1, 3> seq;
- *   auto a = std::make_tuple(1, 2.0, false, 'a');
- *   auto b = extract_tuple(a, seq);
- *   std::cout << std::get<0>(b) << '\n'; // 2
- *   std::cout << std::get<1>(b) << '\n'; // a
- *   return 0;
- * }
- * @endcode
- */
-template<class T, T... N>
-class integer_sequence {
-};
-
-namespace bits {
-  template<class T, long long N, long long... M>
-  struct make_integer_sequence :
-    make_integer_sequence<T, N-1, N-1, M...>
-  {};
-  template<class T, long long... M>
-  struct make_integer_sequence<T, 0, M...> {
-    typedef integer_sequence<T, (T) M...> type;
-  };
-}
-
-/** A compile-time sequence of integers of the form `(0,1,2,3,...,N-1)` (from C++14) */
-template<class T, T N>
-using make_integer_sequence = typename simgrid::xbt::bits::make_integer_sequence<T,N>::type;
-
-/** A compile-time sequence of indices (from C++14) */
-template<std::size_t... Ints>
-using index_sequence = integer_sequence<std::size_t, Ints...>;
-
-/** A compile-time sequence of indices of the form `(0,1,2,3,...,N-1)` (from C++14) */
-template<std::size_t N>
-using make_index_sequence = make_integer_sequence<std::size_t, N>;
-
-/** Convert a type parameter pack into a index_sequence (from C++14) */
-template<class... T>
-using index_sequence_for = make_index_sequence<sizeof...(T)>;
-
-static_assert(std::is_same< make_index_sequence<0>, index_sequence<> >::value, "seq0");
-static_assert(std::is_same< make_index_sequence<1>, index_sequence<0> >::value, "seq1");
-static_assert(std::is_same< make_index_sequence<2>, index_sequence<0, 1> >::value, "seq2");
-static_assert(std::is_same< make_index_sequence<3>, index_sequence<0, 1, 2> >::value, "seq3");
-static_assert(std::is_same< index_sequence_for<int,double,float>, make_index_sequence<3> >::value, "seq4");
-
 }
 }
 #endif
index 0a070d4..c228836 100644 (file)
@@ -12,9 +12,7 @@
 #include "xbt/log.h"
 #include "xbt/sysdep.h"
 
-#if __cplusplus >= 201402L
 #include "src/include/xxhash.hpp"
-#endif
 #include "src/mc/mc_mmu.hpp"
 #include "src/mc/sosp/PageStore.hpp"
 
@@ -34,18 +32,7 @@ namespace mc {
  */
 static XBT_ALWAYS_INLINE PageStore::hash_type mc_hash_page(const void* data)
 {
-#ifdef __cplusplus >= 201402L
   return xxh::xxhash<64>(data, xbt_pagesize);
-#else
-  const std::uint64_t* values = (const uint64_t*)data;
-  std::size_t n               = xbt_pagesize / sizeof(uint64_t);
-
-  // This djb2:
-  std::uint64_t hash = 5381;
-  for (std::size_t i = 0; i != n; ++i)
-    hash = ((hash << 5) + hash) + values[i];
-  return hash;
-#endif
 }
 
 // ***** snapshot_page_manager