Boost logo

Boost Users :

Subject: [Boost-users] [MultiArray] Bound Guarding
From: loadcom (loadcom_at_[hidden])
Date: 2008-12-20 20:29:55


Hello,

I'm using boost::multi_array for a while and find it very powerful
except one point that I cannot specify an array_view's number of
dimentions at runtime. But this pity is not the topic of this post.

You know one can create an array_view with arbirary given start/bound
indices as well as the stride as follows:

typedef boost::multi_array<T, 3> array_t;
array_t myarray;
//...
typedef array_t::index_range range_t;
typename array_t::array_view::view<2> myview =
    myarrray[boost::indices[range_t(0, 8, 2)][rang_t()][1]];

As I don't know in the internal of the lib how the dound guarding of
iteration is done, either

- in the 'standard' STL manner as i!=bound; or
- in the 'conventional' C stale as i<bound

my concern is in case that one advetently specify 'range_t(0, 8, 2)' as
range_t(0, 7, 2), if this error cause undefined behavior, or
is as save as it correct form, or, seemingly impossible, detected
at runtime or even compile time?

Thanks for any concern.

Best regards
Max

-------------------------------------------------------------------
ÐÂÀ˿ռ䡪¡ªÓëÅóÓÑ¿ªÐÄ·ÖÏíÍøÂçÐÂÉú»î£¡(http://space.sina.com.cn/ )


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