Boost logo

Boost :

Subject: Re: [boost] Unittest capability for meta-programs feedback request
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-09-27 17:26:54

Le 27/09/11 08:43, Ben Robinson a écrit :
> This submission would make it possible to write a complete set of unit
> tests for meta-programs, to test both the positive, compiling statements,
> and the negative, non-compiling statements. These tests will all compile,
> and the negative tests can throw an exception instead of failing to compile.
> ...
> I look forward to your feedback. Thank you,


I start to understand what you want to achieve. Your example is quite
simple and shows that in general there will be a redundancy on the test,
once to avoid the invalid instantiation and the other to assert the
valid condition (even if in your example you have used the test to end
the recursion to give a valid value).

If I have understood correctly the result of the meta-function should be
something that behaves as a valid result when the condition is not
satisfied. I'm not sure this is always possible, as Dave as already
said, and even if it is possible in common cases this should not always
be simple. The documentation should show more concrete cases.

Other uses of meta-asserts could use intermediary results. Avoiding
compilation failure in these cases will result in additional complexity
on the meta-function implementation.

In order to see if your approach can be used in regular meta-programs it
would be great if you can show more complex examples can be written
with a without your macros.


Boost list run by bdawes at, gregod at, cpdaniel at, john at