|
Boost : |
From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-05-27 05:03:49
"Alexander Nasonov" <alnsn-boost_at_[hidden]> wrote
> #include <boost/mpl/assert.hpp>
> #include <boost/mpl/equal.hpp>
> #include <boost/mpl/vector_c.hpp>
>
> char (&foo())[9][8][7][6];
>
> int main()
> {
> using namespace boost::mpl;
>
> typedef vector_c<
> int
> , sizeof(foo()) / sizeof(foo()[0])
> , sizeof(foo()[0]) / sizeof(foo()[0][0])
> , sizeof(foo()[0][0]) / sizeof(foo()[0][0][0])
> , sizeof(foo()[0][0][0]) / sizeof(foo()[0][0][0][0])
> > vec;
>
> BOOST_MPL_ASSERT(( equal< vec, vector_c<int,9,8,7,6> > ));
> }
An interesting alternative. Instead of passing the desired vector position
into foo(), just return everything in a multi-dimensional array. Have to
give it more thought...
Still don't see how it would help with ODR, though...
Regards,
Arkadiy
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk