Boost logo

Boost Users :

Subject: [Boost-users] [exception] array tags
From: Diederick C. Niehorster (dcnieho_at_[hidden])
Date: 2009-10-24 23:09:00


Hi,

I have just discovered boost::exception and am very happy I did. One
thing i would like to do, but haven't yet figure out:

I have a matrix class for which I want to throw exceptions when
out_of_range requests are made. One of the extra tags I want to attach
is the dimensions of the matrix and it would be neat if i can put
those in an array. Defining the tag is no problem, getting the info in
there is:

defining:
typedef boost::error_info<struct tag_std_range_size,size_t[2]> std_range_size;

I have tried:
<< std_range_size({m_nRows, m_nCols});
size_t a[2] = {m_nRows, m_nCols};
<< std_range_size(a);
and desperately even << std_range_size() = {m_nRows, m_nCols}; which
doesn't make much sense

Can I do such a thing, should I use something else than a plain array
or do i have to resort to two separate tags for nRows adn nCols
respectively?

Thank you for your help and advice!
Best,
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