]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Revert r27495 and do it properly
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 10 Nov 2012 10:08:58 +0000 (10:08 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 10 Nov 2012 10:08:58 +0000 (10:08 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_cmake@27498 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/point.h

index b247ce6cc74ceb8e3c0c6f4e12fb9539149f6df8..b94c66b704cc959246ab2a4bd69edb3acc3a449c 100644 (file)
@@ -224,9 +224,12 @@ template <int dim, typename Number>
 inline
 Point<dim,Number>::Point (const Number x)
 {
-  Assert (dim==1, StandardExceptions::ExcInvalidConstructorCall());
-  if(dim != 1) return;
-  this->values[0] = x;
+  switch(dim) {
+    case 1:
+      this->values[0] = x;
+    default:
+      Assert (dim==1, StandardExceptions::ExcInvalidConstructorCall());
+  }
 }
 
 
@@ -235,10 +238,13 @@ template <int dim, typename Number>
 inline
 Point<dim,Number>::Point (const Number x, const Number y)
 {
-  Assert (dim==2, StandardExceptions::ExcInvalidConstructorCall());
-  if(dim != 2) return;
-  this->values[0] = x;
-  this->values[1] = y;
+  switch(dim) {
+    case 2:
+      this->values[0] = x;
+      this->values[1] = y;
+    default:
+      Assert (dim==2, StandardExceptions::ExcInvalidConstructorCall());
+  }
 }
 
 
@@ -247,11 +253,14 @@ template <int dim, typename Number>
 inline
 Point<dim,Number>::Point (const Number x, const Number y, const Number z)
 {
-  Assert (dim==3, StandardExceptions::ExcInvalidConstructorCall());
-  if(dim != 3) return;
-  this->values[0] = x;
-  this->values[1] = y;
-  this->values[2] = z;
+  switch(dim) {
+    case 3:
+      this->values[0] = x;
+      this->values[1] = y;
+      this->values[2] = z;
+    default:
+      Assert (dim==3, StandardExceptions::ExcInvalidConstructorCall());
+  }
 }
 
 

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.