Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63403 - sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch
From: cppljevans_at_[hidden]
Date: 2010-06-27 22:19:30


Author: cppljevans
Date: 2010-06-27 22:19:28 EDT (Sun, 27 Jun 2010)
New Revision: 63403
URL: http://svn.boost.org/trac/boost/changeset/63403

Log:
Use templated exception to get better error message.

Text files modified:
   sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/apply_unpack.hpp | 14 +++++++++++++-
   1 files changed, 13 insertions(+), 1 deletions(-)

Modified: sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/apply_unpack.hpp
==============================================================================
--- sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/apply_unpack.hpp (original)
+++ sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/apply_unpack.hpp 2010-06-27 22:19:28 EDT (Sun, 27 Jun 2010)
@@ -12,6 +12,7 @@
 #include <boost/mpl/package_range_c.hpp>
 #include <boost/type_traits/remove_cv.hpp>
 #include <boost/function_types/can_be_called.hpp>
+#include <exception>
 
 namespace boost
 {
@@ -49,6 +50,17 @@
 {
     return ftor(args...);
 };
+
+ template<typename FunctorArgs>
+struct bad_functor_args
+ : public std::exception
+{
+ virtual const char * what() const throw()
+ {
+ return "boost::composite_storage::pack::multiple_dispatch::bad_functor_args: "
+ "Functor not defined for Args.";
+ }
+};
   template
   < typename Functor
   , typename... Args
@@ -60,7 +72,7 @@
   , Args const&... args
   )
 {
- std::cout<<"!!!ftor cannot be called with given args.\n";
+ throw bad_functor_args<Functor(Args const&...)>();
     return typename functor_result_type<Functor>::type();
 };
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk