Boost logo

Boost :

From: Alexander Nasonov (alnsn-boost_at_[hidden])
Date: 2005-05-27 05:12:18


Peder Holt <peder.holt <at> gmail.com> writes:

> On 5/27/05, Alexander Nasonov <alnsn-boost <at> yandex.ru> wrote:
> > Sizes may become very huge, though.
>
> If you replace your function with:
> char (&foo())[900][800][700][600];
> you will get an overflow when calculating e.g. sizeof(foo()) /
> sizeof(foo()[0]),
> and the result will be garbage.

That's right.
Huge arrays can be replaced with tuples.

tuple<char(&)[9], char(&)[8], char(&)[7], char(&)[6]> foo();

sizeof(get<0>(foo()));
sizeof(get<1>(foo()));
sizeof(get<2>(foo()));
sizeof(get<3>(foo()));

Not sure if it compiles with boost::tuple.

--
Alexander Nasonov

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk