Boost logo

Boost :

Subject: Re: [boost] BOOST_PP array extension proposal
From: Edward Diener (eldiener_at_[hidden])
Date: 2015-09-11 18:49:11


On 9/11/2015 4:21 PM, Antoine Leblanc wrote:
> On 11 September 2015 at 13:57, Edward Diener <eldiener_at_[hidden]> wrote:
>> It uses a Jamfile.v2 in the test sub-directory and tests in *.cxx files in
>> the test sub-directory. For arrays look at array.cxx and for tuples look at
>> tuple.cxx. Ideally every Boost PP macro should have its won .cxx file but I
>> never got around to implementing that.
>
> A question about that. With the way those tests are made, one can only
> compare numerical values at compile time, which means all array tests
> are either a call to ARRAY_ELEM, ARRAY_SIZE or ARRAY_IS_EMPTY. I'd
> like to find a way to write tests that compare entire arrays / tuples.
> A naive way to do that would be to STRINGIZE the arrays and compare
> the resulting strings at runtime.
>
> However, it seems to me that doing runtime checks would be a big
> change to the way BOOST_PP is currently tested, and I'd like your
> opinion on that subject before doing anything.
>

If you were using VMD you could use BOOST_VMD_EQUAL ( that's a shameless
plug for my library ) but since we are in Boost PP land you could create
your own macro for testing purposes which compares each array element's
numeric value to see if the arrays are equal or not, returning 1 if they
are not and 0 if they are. Then we are back the way the tests are done
comparing numeric values at compile time.


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