Martin Sebor wrote:
>
>Eric Lemings wrote:
>>  
>> For compile-time tests, would it be preferable to use a 
>static assertion
>> or continue using good ol' rw_assert() even for compile-time 
>checks?  In
>> the former case, the test will fail to build and, in the latter case,
>> the compile-time check will not be easily distinguisable from other
>> runtime assertions.
>
>I would recommend against using one component of the library
>(static_assert) to test another.
>
>The approach taken by existing tests is to verify types and
>signatures by using them in ways that would make the tests
>ill-formed if they didn't match the requirements, causing
>a compiler error. You can see examples of this approach in
>the 23.vector.cons.cpp test that was just mentioned.
>

I happen to use this trick ..

  typedef char assert_0 [(cond) ? 1 : -1];

>Martin
>

Reply via email to