]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make fixed_power also work for data types that have no implicit conversion from int...
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Sun, 21 Apr 2013 17:23:40 +0000 (17:23 +0000)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Sun, 21 Apr 2013 17:23:40 +0000 (17:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@29355 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/utilities.h

index a4924d180024b9a8b698082ee420d44ab046d118..a7a3591becff7884d36aa1094e7a1808a13ec554 100644 (file)
@@ -680,8 +680,6 @@ namespace Utilities
     Assert (N>0, ExcNotImplemented());
     switch (N)
       {
-      case 0:
-        return 1;
       case 1:
         return n;
       case 2:
@@ -691,8 +689,8 @@ namespace Utilities
       case 4:
         return n*n*n*n;
       default:
-        T result = 1;
-        for (int d=0; d<N; ++d)
+        T result = n;
+        for (int d=1; d<N; ++d)
           result *= n;
         return result;
       }

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.