]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Mark a number of ReferenceCell functions as 'constexpr'. 11597/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 21 Jan 2021 01:58:58 +0000 (18:58 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 21 Jan 2021 17:29:34 +0000 (10:29 -0700)
include/deal.II/grid/reference_cell.h

index 46f33a7ff4a72174cf70c49c7752890fbbcc4f87..79b614d8f02f53be755a689331e85c5c5e322d7a 100644 (file)
@@ -64,12 +64,12 @@ namespace ReferenceCell
     /**
      * Default constructor. Initialize this object as an invalid object.
      */
-    Type();
+    constexpr Type();
 
     /**
      * Constructor.
      */
-    Type(const std::uint8_t kind);
+    constexpr Type(const std::uint8_t kind);
 
     /**
      * Return the dimension of the reference cell represented by the current
@@ -134,18 +134,18 @@ namespace ReferenceCell
     /**
      * Conversion operator to an integer.
      */
-    operator std::uint8_t() const;
+    constexpr operator std::uint8_t() const;
 
     /**
      * Operator for equality comparison.
      */
-    bool
+    constexpr bool
     operator==(const Type &type) const;
 
     /**
      * Operator for inequality comparison.
      */
-    bool
+    constexpr bool
     operator!=(const Type &type) const;
 
     /**
@@ -172,26 +172,26 @@ namespace ReferenceCell
 
 
 
-  inline Type::Type()
-    : Type(Invalid)
+  inline constexpr Type::Type()
+    : Type(static_cast<std::uint8_t>(-1))
   {}
 
 
 
-  inline Type::Type(const std::uint8_t kind)
+  inline constexpr Type::Type(const std::uint8_t kind)
     : kind(kind)
   {}
 
 
 
-  inline Type::operator std::uint8_t() const
+  inline constexpr Type::operator std::uint8_t() const
   {
     return kind;
   }
 
 
 
-  inline bool
+  inline constexpr bool
   Type::operator==(const Type &type) const
   {
     return kind == type.kind;
@@ -199,7 +199,7 @@ namespace ReferenceCell
 
 
 
-  inline bool
+  inline constexpr bool
   Type::operator!=(const Type &type) const
   {
     return kind != type.kind;

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.