From: Peder Holt (peder.holt_at_[hidden])
Date: 2005-05-27 13:07:46
On 5/27/05, David Abrahams <dave_at_[hidden]> wrote:
> Alexander Nasonov <alnsn-boost_at_[hidden]> writes:
> > 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());
> >> you will get an overflow when calculating e.g. sizeof(foo()) /
> >> sizeof(foo()),
> >> and the result will be garbage.
> > That's right.
> > Huge arrays can be replaced with tuples.
> > tuple<char(&), char(&), char(&), char(&)> foo();
> Why not an mpl::vector for that matter?
> It's easy enough to extract each dimension of an array with partial
> specialization. Just do the representation backwards:
> char (& foo( whatever ) ) [CODEN][CODEN-1]...[CODE1][CODE0]
> Steve Dewhurst was here before us.
> > sizeof(get<0>(foo())); sizeof(get<1>(foo())); sizeof(get<2>(foo()));
> > sizeof(get<3>(foo()));
> > Not sure if it compiles with boost::tuple.
> Inefficient at compile time. get<N> is O(N) each time, thus the above
> is O(N^2); that's part of what's behind the fusion library.
I made a version of typeof_impl that uses a single function invocation
and an additional encode struct invocation (in addition to
Instead of taking the size of a function,
I take the size of a member of the struct returned by a function.
Access element 1: sizeof(at<1>(expr))
Access element 1: sizeof(typeof_result(expr).value1)
If this is in any way better performance-wise than the current
implementation, I do not know.
> Dave Abrahams
> Boost Consulting
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk