Boost logo

Boost :

Subject: Re: [boost] BOOST_PP array extension proposal
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2015-09-10 17:44:12


On Thu, Sep 10, 2015 at 2:11 PM, Edward Diener <eldiener_at_[hidden]>
wrote:
>
> Given that variadic macros are supported for just about all compilers now,
> the Boost PP array is largely obsolete as the Boost PP tuple has all the
> functionality which an array has except for the fact that a tuple can never
> hold 0 elements while an array can. Therefore I am trying to phase out the
> use of Boost PP arrays in favor of Boost PP tuples.

This might just be just paranoia, but has there ever been profiling done
regarding large usage of PP tuple-based code vs PP array-based code? I've
experienced some pretty drastic differences in memory usage during
compilation when switching between different looping constructs and
container types, etc. and it's not always immediately obvious why. There is
certainly at least some minimal cost to always using tuples, IIUC.
Particularly if these operations are performed inside of repetition
constructs, though, especially with a compiler that does sophisticated
macro expansion tracking, seemingly minimal differences might actually
become noticeable. I've never done the benchmark myself, but I just think
it might be best to proceed with caution before encouraging switching over
whole-sale to tuples.

I wonder if, instead, we might also consider the opposite approach. By that
I mean consider using arrays and phasing out direct tuple operations,
except for the ability to create a PP array from a PP tuple, automatically
deducing the size. As you mentioned, arrays can properly represent an empty
range, so that alone might be a good reason to prefer it as the go-to
tuple-like container, even with all else being equal. I haven't given a lot
of thought to this, though, but I'm sure Paul would also have some pretty
good input on the matter. Do you know his stance on this?

-Matt Calabrese


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