]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Make constructor calls with multiple doubles simpler by using templates.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 21 Feb 2001 14:41:58 +0000 (14:41 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 21 Feb 2001 14:41:58 +0000 (14:41 +0000)
git-svn-id: https://svn.dealii.org/trunk@4000 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 9eb2b92ba145ad163e618988a786dfa58dc18371..225378395ebafb9f94fdcef214d7375aa98b9b01 100644 (file)
@@ -184,83 +184,32 @@ Point<dim>::Point (const Tensor<1,dim> &t) :
 
 
 
-template <>
+template <int dim>
 inline
-Point<1>::Point (const double x)
+Point<dim>::Point (const double x)
 {
+  Assert (dim==1, ExcInvalidConstructorCalled());
   values[0] = x;
 };
 
 
 
-template <>
-inline
-Point<1>::Point (const double, const double) 
-{
-  Assert (false, ExcInvalidConstructorCalled());
-};
-
-
-
-template <>
-inline
-Point<1>::Point (const double, const double, const double) 
-{
-  Assert (false, ExcInvalidConstructorCalled());
-};
-
-
-
-template <>
-inline
-Point<2>::Point (const double) 
-{
-  Assert (false, ExcInvalidConstructorCalled());
-};
-
-
-
-template <>
+template <int dim>
 inline
-Point<2>::Point (const double x, const double y) 
+Point<dim>::Point (const double x, const double y)
 {
+  Assert (dim==2, ExcInvalidConstructorCalled());
   values[0] = x;
   values[1] = y;
 };
 
 
 
-template <>
-inline
-Point<2>::Point (const double, const double, const double) 
-{
-  Assert (false, ExcInvalidConstructorCalled());
-};
-
-
-
-template <>
-inline
-Point<3>::Point (const double) 
-{
-  Assert (false, ExcInvalidConstructorCalled());
-};
-
-
-
-template <>
-inline
-Point<3>::Point (const double, const double) 
-{
-  Assert (false, ExcInvalidConstructorCalled());
-};
-
-
-
-template <>
+template <int dim>
 inline
-Point<3>::Point (const double x, const double y, const double z) 
+Point<dim>::Point (const double x, const double y, const double z)
 {
+  Assert (dim==3, ExcInvalidConstructorCalled());
   values[0] = x;
   values[1] = y;
   values[2] = z;
@@ -268,24 +217,6 @@ Point<3>::Point (const double x, const double y, const double z)
 
 
 
-template <>
-inline
-Point<4>::Point (const double, const double) 
-{
-  Assert (false, ExcInvalidConstructorCalled());
-};
-
-
-
-template <>
-inline
-Point<4>::Point (const double, const double, const double) 
-{
-  Assert (false, ExcInvalidConstructorCalled());
-};
-
-
-
 template <int dim>
 inline
 double Point<dim>::operator () (const unsigned int index) const

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.