summaryrefslogtreecommitdiff
path: root/i/marvin/src/utils/any.tcc
diff options
context:
space:
mode:
Diffstat (limited to 'i/marvin/src/utils/any.tcc')
-rw-r--r--i/marvin/src/utils/any.tcc27
1 files changed, 21 insertions, 6 deletions
diff --git a/i/marvin/src/utils/any.tcc b/i/marvin/src/utils/any.tcc
index fd3dca6..e942156 100644
--- a/i/marvin/src/utils/any.tcc
+++ b/i/marvin/src/utils/any.tcc
@@ -1,7 +1,13 @@
+#ifndef any_tcc
+#define any_tcc
// any.tcc
-// robert - programme du robot 2005. {{{
+// marvin - programme du robot 2006. {{{
//
-// Copyright (C) 2004 Nicolas Schodet
+// Copyright (C) 2003-2006 Nicolas Schodet
+//
+// Robot APB Team/Efrei 2006.
+// Web: http://assos.efrei.fr/robot/
+// Email: robot AT efrei DOT fr
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,9 +23,6 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
-// Contact :
-// Web: http://perso.efrei.fr/~schodet/
-// Email: <contact@ni.fr.eu.org>
// }}}
#include "list_ostream_output.hh"
@@ -155,10 +158,22 @@ any_cast (const any &rhs)
{
const T *value = any_cast<T> (&rhs);
if (!value)
- throw bad_any_cast ();
+ throw bad_any_cast (typeid (T), rhs.type ());
return *value;
}
+/// Constructor.
+inline
+bad_any_cast::bad_any_cast (const std::type_info &from,
+ const std::type_info &to)
+{
+ what_ = "illegal conversion from \'";
+ what_ += from.name ();
+ what_ += "\' to \'";
+ what_ += to.name ();
+ what_ += "\'";
+}
+
/// Print the contained object.
inline
std::ostream &