]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Vectorization: move assert into constructor
authorMatthias Maier <tamiko@43-1.org>
Tue, 2 Apr 2024 21:07:17 +0000 (16:07 -0500)
committerMatthias Maier <tamiko@43-1.org>
Wed, 3 Apr 2024 23:01:58 +0000 (18:01 -0500)
include/deal.II/base/vectorization.h

index 9511a853a1d4003e46f7e6a63daa0803b2999292..c6603069adfa454ee5ad017e8ae8256ed17efd23 100644 (file)
@@ -455,9 +455,6 @@ public:
    */
   using value_type = Number;
 
-  static_assert(width == 1,
-                "You specified an illegal width that is not supported.");
-
   /**
    * Default empty constructor, leaving the data in an uninitialized state
    * similar to float/double.
@@ -469,6 +466,9 @@ public:
    */
   VectorizedArray(const Number scalar)
   {
+    static_assert(width == 1,
+                  "You specified an illegal width that is not supported.");
+
     this->operator=(scalar);
   }
 
@@ -478,7 +478,10 @@ public:
   template <typename U>
   VectorizedArray(const std::initializer_list<U> &list)
     : VectorizedArrayBase<VectorizedArray<Number, width>, 1>(list)
-  {}
+  {
+    static_assert(width == 1,
+                  "You specified an illegal width that is not supported.");
+  }
 
   /**
    * This function assigns a scalar to the current object.

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.