Boost logo

Boost Users :

From: Benoit Hudson (benoit.hudson_at_[hidden])
Date: 2007-06-05 15:46:52


On 6/5/07, Benoit Hudson <benoit.hudson_at_[hidden]> wrote:
> On 6/4/07, Chris Weed <chrisweed_at_[hidden]> wrote:
> > On 6/3/07, Benoit Hudson <benoit.hudson_at_[hidden]> wrote:
> > > Reading the archives, I see that the idea of adding a
> > > template <unsigned i> T get();
> > > function to boost::array has been somewhat summarily rejected as unnecessary:
> > > http://lists.boost.org/boost-users/2005/08/12983.php
> > > et seq.
> > >
> > > And yet I'm finding myself wanting it repeatedly. Here are three
> > > places I've seen it crop up:
> > >
> >
> > Isn't this functionality available using the boost::fusion extension
> > for array? You might want to take a look at boost::fusion.
> > Chris
>
> Doesn't appear to. The following compiles against CVS of 5 minutes
> ago, without error:
> #include <boost/array.hpp>
> #include <boost/fusion/sequence/adapted.hpp>
> #include <boost/fusion/sequence/intrinsic.hpp>
>
> boost::array<int, 3> arr = {{ 1, 2, 3}};
>
> int x() {
> // arr[4]
> return boost::fusion::at_c<4>(arr);
> }
>
> It compiles down to a call to __assert_fail, which is the same
> behaviour as just using arr[4].

Following all the #includes and templates, I guess it's that
boost/fusion/sequence/adapted/array/detail/at_impl.hpp lines 36-40
should probably have a BOOST_STATIC_ASSERT in there?

-- Benoît


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