]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move a few generic names into a namespace that explains what things refer to.
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 27 Jan 2022 00:15:26 +0000 (17:15 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 27 Jan 2022 00:15:26 +0000 (17:15 -0700)
include/deal.II/base/template_constraints.h

index 4f6efbbd8661aa5f817ff05d8542b64eeaa4c5c7..3d9673bf6dbe8375c211e76336048e1b1316fc0e 100644 (file)
@@ -31,51 +31,58 @@ DEAL_II_NAMESPACE_OPEN
 // Fundamentals, ISO/IEC TS 19568:2017
 namespace internal
 {
-  template <class...>
-  using void_t = void;
-
-  // base class for nonesuch to inherit from so it is not an aggregate
-  struct nonesuch_base
-  {};
-
-  // primary template handles all types not supporting the archetypal Op
-  template <class Default,
-            class /*AlwaysVoid*/,
-            template <class...>
-            class Op,
-            class... /*Args*/>
-  struct detector
+  namespace SupportsOperation
   {
-    using value_t = std::false_type;
-    using type    = Default;
-  };
+    template <class...>
+    using void_t = void;
+
+    // base class for nonesuch to inherit from so it is not an aggregate
+    struct nonesuch_base
+    {};
+
+    // primary template handles all types not supporting the archetypal Op
+    template <class Default,
+              class /*AlwaysVoid*/,
+              template <class...>
+              class Op,
+              class... /*Args*/>
+    struct detector
+    {
+      using value_t = std::false_type;
+      using type    = Default;
+    };
 
-  // specialization recognizes and handles only types supporting Op
-  template <class Default, template <class...> class Op, class... Args>
-  struct detector<Default, void_t<Op<Args...>>, Op, Args...>
-  {
-    using value_t = std::true_type;
-    using type    = Op<Args...>;
-  };
+    // specialization recognizes and handles only types supporting Op
+    template <class Default, template <class...> class Op, class... Args>
+    struct detector<Default, void_t<Op<Args...>>, Op, Args...>
+    {
+      using value_t = std::true_type;
+      using type    = Op<Args...>;
+    };
 
 
 
-  struct nonesuch : private internal::nonesuch_base
-  {
-    ~nonesuch()                = delete;
-    nonesuch(nonesuch const &) = delete;
-    void
-    operator=(nonesuch const &) = delete;
-  };
+    struct nonesuch : private nonesuch_base
+    {
+      ~nonesuch()                = delete;
+      nonesuch(nonesuch const &) = delete;
+      void
+      operator=(nonesuch const &) = delete;
+    };
+
+  } // namespace SupportsOperation
 
   template <class Default, template <class...> class Op, class... Args>
-  using detected_or = internal::detector<Default, void, Op, Args...>;
+  using detected_or =
+    internal::SupportsOperation::detector<Default, void, Op, Args...>;
 
   template <template <class...> class Op, class... Args>
-  using is_detected = typename detected_or<nonesuch, Op, Args...>::value_t;
+  using is_detected =
+    typename detected_or<SupportsOperation::nonesuch, Op, Args...>::value_t;
 
   template <template <class...> class Op, class... Args>
-  using detected_t = typename detected_or<nonesuch, Op, Args...>::type;
+  using detected_t =
+    typename detected_or<SupportsOperation::nonesuch, Op, Args...>::type;
 
   template <class Default, template <class...> class Op, class... Args>
   using detected_or_t = typename detected_or<Default, Op, Args...>::type;

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.