On Jun 11, 2008, at 1:57 PM, Travis Vitek wrote:



Eric Lemings wrote:


Travis Vitek wrote:



...


I've written an errily similar test already (pasted below)


I like your test better except for two things.

1. Need a static assert at file scope similar to the one in main().

2. Change main() to foo().  We don't need (nor want) to run the a
program; just compile the source file (which is when static_assert's
are supposed to fire).


True on both counts.

On a related note, we already have __rw_compile_assert [see rw/ _defs.h],
but it doesn't work at global or class scope.

I provided an __rw_static_assert for use with type_traits in my original
patch, but it didn't work outside of a template. I've got an updated
version that will work in all cases. I'm thinking that I should replace
the existing __rw_compile_assert with __rw_static_assert, and then
define a macro _RWSTD_STATIC_ASSERT(Cond,Mesg) that uses static_assert
if it exists, or falls back to ours as needed.

And the macro can be used the same in all cases regardless of whether it is implemented using the compiler's static_assert or our own static assert?

Brad.

Reply via email to