Boost logo

Boost Users :

Subject: Re: [Boost-users] [exception] array tags
From: Diederick C. Niehorster (dcnieho_at_[hidden])
Date: 2009-10-25 02:59:55


Hi Joel,

Thanks for your reply!
That is indeed the problem, I am wondering if there is a way to get
around it so i can still use BOOST_THROW_EXCEPTION as it gives me the
convenience of automatically appending function, file and line
information. BOOST_THROW_EXCEPTION is a macro that is defined as
follows (http://www.boost.org/doc/libs/1_40_0/libs/exception/doc/BOOST_THROW_EXCEPTION.html):
#define BOOST_THROW_EXCEPTION(x)\
        ::boost::throw_exception( ::boost::enable_error_info(x) <<\
        ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
        ::boost::throw_file(__FILE__) <<\
        ::boost::throw_line((int)__LINE__) )

Rethinking the problem from the perspective of your post, I did get
something that compiles, but adds some syntax:
BOOST_THROW_EXCEPTION(boost::enable_error_info(std::out_of_range("Matrix
-=: Inputs do not have same shape")) <<
           std_range_which(Rows()!=M.Rows()? "row" : "col"));

Not ideal, it would be nice if i don't have to add the
boost::enable_error_info() call manually, but I can work with it!

Thanks,
Dee

On Sun, Oct 25, 2009 at 2:39 PM, joel <joel.falcou_at_[hidden]> wrote:
> Diederick C. Niehorster wrote:
>>
>> Simply doing
>> BOOST_THROW_EXCEPTION(std::out_of_range("Matrix -=: Inputs do not have
>> same shape")) <<
>>            std_range_which(Rows()!=M.Rows()? "row" : "col");
>> does not work, nor does
>> BOOST_THROW_EXCEPTION(std::out_of_range("Matrix -=: Inputs do not have
>> same shape") <<
>>            std_range_which(Rows()!=M.Rows()? "row" : "col"))
>
> Maybe because std::out_of_range is not a boost::exception and dosn't support
> << ?
>
>
>
> ___________________________________________
> Joel Falcou - Assistant Professor
> PARALL Team - LRI - Universite Paris Sud XI
> Tel : (+33)1 69 15 66 35
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net