Boost logo

Boost Users :

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


Hi,

I have another question regarding the exception library. I would like
to use the BOOST_THROW_EXCEPTION() macro, but also add some tags of my
own at the throw site. How do I do this?

How would i rewrite the below?
typedef boost::error_info<struct tag_std_range_which,std::string>
std_range_which;
throw boost::enable_error_info(std::out_of_range("Matrix -=: Inputs do
not have same shape")) <<
            std_range_which(Rows()!=M.Rows()? "row" : "col");

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"));

Thank you!
Diederick


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