]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Clean up DEAL_II_HAVE_CXX17
authorDaniel Arndt <arndtd@ornl.gov>
Sat, 1 Jul 2023 18:23:37 +0000 (14:23 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Sat, 1 Jul 2023 18:23:37 +0000 (14:23 -0400)
include/deal.II/base/std_cxx17/algorithm.h
include/deal.II/base/std_cxx17/optional.h
include/deal.II/base/std_cxx17/variant.h
include/deal.II/base/thread_local_storage.h
source/base/data_out_base.cc
source/base/table_handler.cc
source/opencascade/utilities.cc
tests/data_out/patches.h

index b4437bdc468e5de18ae87cbe9f2db91bead7b95c..d8404b88a6b6a2e8799b74e5c68095270791fa44 100644 (file)
 
 #include <deal.II/base/config.h>
 
-#ifdef DEAL_II_HAVE_CXX17
-#  include <algorithm>
-#else
-#  include <boost/algorithm/clamp.hpp>
-#endif
+#include <algorithm>
 
 DEAL_II_NAMESPACE_OPEN
 namespace std_cxx17
 {
-#ifndef DEAL_II_HAVE_CXX17
-  using boost::algorithm::clamp;
-#else
   using std::clamp;
-#endif
 } // namespace std_cxx17
 DEAL_II_NAMESPACE_CLOSE
 
index 284f5f4918f2ba2740966548f63f4f3e78c45d60..4d6cc23f2d34d12d7eeaf796cef3e40b9e646020 100644 (file)
 
 #include <deal.II/base/config.h>
 
-#ifdef DEAL_II_HAVE_CXX17
-#  include <optional>
-#else
-#  include <boost/optional.hpp>
-#endif
+#include <optional>
 
 DEAL_II_NAMESPACE_OPEN
 namespace std_cxx17
 {
-#ifndef DEAL_II_HAVE_CXX17
-  using boost::optional;
-#else
   using std::optional;
-#endif
 } // namespace std_cxx17
 DEAL_II_NAMESPACE_CLOSE
 
index 146f0e3223785e9bd2d7303099094cc78a8bb7c1..84cc794db4dbbed536763f0065bdaa7ec977a742 100644 (file)
 
 #include <deal.II/base/config.h>
 
-#ifdef DEAL_II_HAVE_CXX17
-#  include <variant>
-#else
-#  include <boost/variant.hpp>
-#endif
+#include <variant>
 
 DEAL_II_NAMESPACE_OPEN
 namespace std_cxx17
 {
-#ifndef DEAL_II_HAVE_CXX17
-  using boost::get;
-  using boost::variant;
-
-  template <typename T, typename... Ts>
-  bool
-  holds_alternative(const boost::variant<Ts...> &v) noexcept
-  {
-    return boost::get<T>(&v) != nullptr;
-  }
-#else
   using std::get;
   using std::holds_alternative;
   using std::variant;
-#endif
 } // namespace std_cxx17
 DEAL_II_NAMESPACE_CLOSE
 
index 4407c5562723ab708924fa49c85bb7a136f6a69d..05f637ee56ec007e86ca484f7a82b84f7b54028a 100644 (file)
@@ -251,11 +251,7 @@ namespace Threads
      * readers-writer lock
      * (https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock).
      */
-#  ifdef DEAL_II_HAVE_CXX17
     mutable std::shared_mutex insertion_mutex;
-#  else
-    mutable std::shared_timed_mutex insertion_mutex;
-#  endif
 
     /**
      * An exemplar for creating a new (thread specific) copy.
index dc1ba232a7e930a69b2d72a4d12c162f1d3728f8..adc1bac0f4411e06920be47d4ffe854abcd31b13 100644 (file)
@@ -9743,16 +9743,8 @@ namespace DataOutBase
     }
 
     // First import what kind of reference cell we are looking at:
-#ifdef DEAL_II_HAVE_CXX17
     if constexpr (dim > 0)
       in >> patch.reference_cell;
-#else
-    // If we can't use 'if constexpr', work around the fact that we can't
-    // write to a 'const' variable by using a const_cast that is a no-op
-    // whenever the code is actually executed
-    if (dim > 0)
-      in >> const_cast<ReferenceCell &>(patch.reference_cell);
-#endif
 
     // then read all the data that is in this patch
     for (const unsigned int i : patch.reference_cell.vertex_indices())
@@ -9767,16 +9759,8 @@ namespace DataOutBase
     // in dim==1, this is a const variable equal to one that can't be changed.
     unsigned int n_subdivisions;
     in >> n_subdivisions;
-#ifdef DEAL_II_HAVE_CXX17
     if constexpr (dim > 1)
       patch.n_subdivisions = n_subdivisions;
-#else
-    // If we can't use 'if constexpr', work around the fact that we can't
-    // write to a 'const' variable by using a const_cast that is a no-op
-    // whenever the code is actually executed
-    if (dim > 1)
-      const_cast<unsigned int &>(patch.n_subdivisions) = n_subdivisions;
-#endif
 
     in >> patch.points_are_available;
 
index b076ee1bf99e2030820caab0efec0fee29a5ca25..61f2b529dd73971b8c067cbcc36095dd1dd82637 100644 (file)
@@ -91,11 +91,7 @@ namespace internal
     else
       ss.setf(std::ios::fixed, std::ios::floatfield);
 
-#ifdef DEAL_II_HAVE_CXX17
     std::visit([&ss](auto &v) { ss << v; }, value);
-#else
-    ss << value;
-#endif
 
     cached_value = ss.str();
     if (cached_value.size() == 0)
@@ -108,38 +104,16 @@ namespace internal
     return cached_value;
   }
 
-
-#ifndef DEAL_II_HAVE_CXX17
-  namespace Local
-  {
-    // see which type we can cast to, then use this type to create
-    // a default constructed object
-    struct SetValueToDefault : public boost::static_visitor<>
-    {
-      template <typename T>
-      void
-      operator()(T &operand) const
-      {
-        operand = T();
-      }
-    };
-  } // namespace Local
-#endif
-
   TableEntry
   TableEntry::get_default_constructed_copy() const
   {
     TableEntry new_entry = *this;
-#ifndef DEAL_II_HAVE_CXX17
-    boost::apply_visitor(Local::SetValueToDefault(), new_entry.value);
-#else
     // Let std::visit figure out which data type is actually stored,
     // and then set the object so stored to a default-constructed
     // one.
     std::visit([](
                  auto &arg) { arg = std::remove_reference_t<decltype(arg)>(); },
                new_entry.value);
-#endif
 
     return new_entry;
   }
@@ -728,11 +702,7 @@ TableHandler::write_tex(std::ostream &out, const bool with_header) const
           else
             out.setf(std::ios::fixed, std::ios::floatfield);
 
-#ifdef DEAL_II_HAVE_CXX17
           std::visit([&out](auto &v) { out << v; }, column.entries[i].value);
-#else
-          out << column.entries[i].value;
-#endif
 
           if (j < n_cols - 1)
             out << " & ";
index facee29430f3891ccb32e428cc28a880029933c2..5ec92e4a55822b51a7ea803b2110c8bc9acdab93 100644 (file)
@@ -710,13 +710,8 @@ namespace OpenCASCADE
     double minDistance = 1e7;
     gp_Pnt tmp_proj(0.0, 0.0, 0.0);
 
-#  ifdef DEAL_II_HAVE_CXX17
-    [[maybe_unused]] unsigned int counter = 0;
-#  else
-    unsigned int     counter = 0;
-    (void)counter;
-#  endif
-    unsigned int face_counter = 0;
+    [[maybe_unused]] unsigned int counter      = 0;
+    unsigned int                  face_counter = 0;
 
     TopoDS_Shape out_shape;
     double       u = 0;
index a3e1cc57863e91e71b886faaa3b41d20c9550316..2f23985677a61b346b8ef1da849e24c4d3c2619d 100644 (file)
@@ -34,22 +34,11 @@ create_patches(std::vector<DataOutBase::Patch<dim, spacedim>> &patches)
       const unsigned int nsub  = p + 1;
       const unsigned int nsubp = nsub + 1;
 
-#ifdef DEAL_II_HAVE_CXX17
       if constexpr (dim > 0)
         patch.n_subdivisions = nsub;
-#else
-      if (dim > 0)
-        const_cast<unsigned int &>(patch.n_subdivisions) = nsub;
-#endif
 
-#ifdef DEAL_II_HAVE_CXX17
       if constexpr (dim > 0)
         patch.reference_cell = ReferenceCells::get_hypercube<dim>();
-#else
-      if (dim > 0)
-        const_cast<ReferenceCell &>(patch.reference_cell) =
-          ReferenceCells::get_hypercube<dim>();
-#endif
 
       for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
         for (unsigned int d = 0; d < spacedim; ++d)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.