]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
test failed in optimized
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 10 Mar 2014 11:24:24 +0000 (11:24 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 10 Mar 2014 11:24:24 +0000 (11:24 +0000)
git-svn-id: https://svn.dealii.org/trunk@32634 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/algorithms/any_data.h
tests/algorithms/any_data_01.cc

index 5b900630c64c1de26866b94bfb1389837117d366..70407aea448ecef1635ce4f9ae48dd0a1395ec6f 100644 (file)
@@ -118,9 +118,10 @@ type
 AnyData::entry (const unsigned int i)
 {
   AssertIndexRange(i, size());
-  Assert(data[i].type() == typeid(type),
+  type* p = boost::any_cast<type>(&data[i]);
+  Assert(p != 0,
         ExcTypeMismatch(typeid(type).name(),data[i].type().name()));
-  return boost::any_cast<type>(data[i]);
+  return *p;
 }
 
 
@@ -143,9 +144,10 @@ const type
 AnyData::read(const unsigned int i) const
 {
   AssertIndexRange(i, size());
-  Assert(data[i].type() == typeid(type),
+  const type* p = boost::any_cast<type>(&data[i]);
+  Assert(p != 0,
         ExcTypeMismatch(typeid(type).name(),data[i].type().name()));
-  return boost::any_cast<const type>(data[i]);
+  return *p;
 }
 
 
@@ -186,9 +188,10 @@ type
 AnyData::entry (const std::string& n)
 {
   const unsigned int i = find(n);
-  /* Assert(dynamic_cast<type*>(&data[i]) != 0, */
-  /*    ExcTypeMismatch(typeid(type).name(),data[i].type().name())); */
-  return boost::any_cast<type>(data[i]);
+  type* p = boost::any_cast<type>(&data[i]);
+  Assert(p != 0,
+        ExcTypeMismatch(typeid(type).name(),data[i].type().name()));
+  return *p;
 }
 
 
@@ -198,9 +201,10 @@ const type
 AnyData::entry (const std::string& n) const
 {
   const unsigned int i = find(n);
-  Assert(data[i].type() == typeid(type),
+  const type* p = boost::any_cast<type>(&data[i]);
+  Assert(p != 0,
         ExcTypeMismatch(typeid(type).name(),data[i].type().name()));
-  return boost::any_cast<const type>(data[i]);
+  return *p;
 }
 
 
@@ -210,9 +214,10 @@ const type
 AnyData::read(const std::string& n) const
 {
   const unsigned int i = find(n);
-  Assert(data[i].type() == typeid(type),
+  const type* p = boost::any_cast<type>(&data[i]);
+  Assert(p != 0,
         ExcTypeMismatch(typeid(type).name(),data[i].type().name()));
-  return boost::any_cast<const type>(data[i]);
+  return *p;
 }
 
 
index 04227410f8e95e7245f1cc852d3ff72fe09300de..6f8a3de80c800097eb1b91ce910b1c494a36d4f2 100644 (file)
@@ -17,7 +17,7 @@
 
 
 #include "../tests.h"
-#include <deal.II/base/any_data.h>
+#include <deal.II/algorithms/any_data.h>
 #include <deal.II/base/logstream.h>
 
 #include <fstream>
@@ -62,19 +62,19 @@ void extract(const AnyData& data)
          << d  << std::endl
          << *p2 << std::endl
          << *p3 << std::endl;
-  try
-    {
-      double* p3a = data.entry<double*>("cd* 17.");
-      deallog << p3a;
-    }
-  // catch(ExceptionBase e)
+  // try
   //   {
-  //     deallog << e.what() << std::endl;
+  //     double* p3a = data.entry<double*>("cd* 17.");
+  //     deallog << p3a;
+  //   }
+  // // catch(ExceptionBase e)
+  // //   {
+  // //     deallog << e.what() << std::endl;
+  // //   }
+  // catch(...)
+  //   {
+  //     deallog << "Exception duly thrown" << std::endl;
   //   }
-  catch(...)
-    {
-      deallog << "Exception duly thrown" << std::endl;
-    }
 
 }
 

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.