|
Boost : |
From: Jaap Suter (J.Suter_at_[hidden])
Date: 2003-03-09 20:57:25
Hi,
I've attached a version of static_assert.hpp that I would find rather
useful. The minimal changes are at the bottom of the file.
It also had me thinking about the static_assert proposal:
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1381.htm
The proposal doesn't say anything about a compile time release and debug
mode. I guess one could always define the 'static_assert' keyword to be
nothing, but perhaps compiler support for disabling and enabling static
assertions is more useful.
Then again, maybe I'm exagerating the usefulness of this. Personally I do
notice a compilation time improvement if I remove all concept-checks, but
that could be my code of course :).
Regards,
Jaap Suter
begin 666 static_assert.hpp
M+R\@("A#*2!#;W!Y<FEG:'0_at_2F]H;B!-861D;V-K(#(P,# N#0HO+R @4&5R
M;6ES<VEO;B!T;R!C;W!Y+"!U<V4L(&UO9&EF>2P@<V5L;"!A;F0-"B\O("!D
M:7-T<FEB=71E('1H:7,@<V]F='=A<F4@:7,@9W)A;G1E9"!P<F]V:61E9"!T
M:&ES(&-O<'ER:6=H="!N;W1I8V4_at_87!P96%R<PT*+R\@(&EN(&%L;"!C;W!I
M97,N(%1H:7,@<V]F='=A<F4@:7,@<')O=FED960@(F%S(&ES(B!W:71H;W5T
M(&5X<')E<W,@;W(@:6UP;&EE9 T*+R\@('=A<G)A;G1Y+"!A;F0@=VET:"!N
M;R!C;&%I;2!A<R!T;R!I=',@<W5I=&%B:6QI='D_at_9F]R(&%N>2!P=7)P;W-E
M+@T*#0HO+R @4V5E(&AT=' Z+R]W=W<N8F]O<W0N;W)G+VQI8G,O<W1A=&EC
M7V%S<V5R="!F;W(@9&]C=6UE;G1A=&EO;BX-"@T*+RH-"B!2979I<VEO;B!H
M:7-T;W)Y._at_T*(" @,#(@075G=7-T(#(P,# -"B @(" @($EN:71I86P@=F5R
M<VEO;BX-"BHO#0H-"B-I9FYD968_at_0D]/4U1?4U1!5$E#7T%34T525%](4% -
M"B-D969I;F4_at_0D]/4U1?4U1!5$E#7T%34T525%](4% -"@T*(VEN8VQU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RD@
M7 T*(" @(" @("!;(#HZ8F]O<W0Z.E-4051)0U]!4U-%4E1)3TY?1D%)3%52
M13P@*&)O;VPI*"!"("D@/CHZ=F%L=64_at_70T*(V5L<V4-"B\O(&=E;F5R:6,@
M=F5R<VEO;@T*(V1E9FEN92!"3T]35%]35$%424-?05-315)47TE-4$PH($(@
M*2!<#0H@("!T>7!E9&5F(#HZ8F]O<W0Z.G-T871I8U]A<W-E<G1?=&5S=#Q<
M#0H@(" @("!S:7IE;V8H.CIB;V]S=#HZ4U1!5$E#7T%34T525$E/3E]&04E,
M55)%/" H8F]O;"DH($(@*2 ^*3Y<#0H@(" @(" @("!"3T]35%]*3TE.*&)O
M;W-T7W-T871I8U]A<W-E<G1?='EP961E9E\L(%]?3$E.15]?*0T*(V5N9&EF
M#0H-"B-E;'-E#0HO+R!A;'1E<FYA=&EV92!E;G5M(&)A<V5D(&EM<&QE;65N
M=&%T:6]N._at_T*(V1E9FEN92!"3T]35%]35$%424-?05-315)47TE-4$PH($(@
M*2!<#0H@("!E;G5M('L_at_0D]/4U1?2D])3BAB;V]S=%]S=&%T:6-?87-S97)T
M7V5N=6U?+"!?7TQ)3D5?7RD_at_7 T*(" @(" @/2!S:7IE;V8H.CIB;V]S=#HZ
M4U1!5$E#7T%34T525$E/3E]&04E,55)%/" H8F]O;"DH($(@*2 ^*2!]#0HC
M96YD:68-"@T*+R\@5&AI<R!I<R!T:&4_at_86-T=6%L($)/3U-47U-4051)0U]!
M4U-%4E0_at_9&5F:6YI=&EO;BX@#0HO+R!);B!C;VUP:6QE+71I;64@<F5L96%S
M92UM;V1E('1H:7,@<F5S=6QT<R!I;B!A(&YO+6]P.PT*(VEF9&5F($)/3U-4
M7U-4051)0U].1$5"54<-"B @(" C9&5F:6YE($)/3U-47U-4051)0U]!4U-%
M4E0H($(@*2!"3T]35%]35$%424-?05-315)47TE-4$PH('1R=64@*0T*(V5L
M<V4-"B @(" C9&5F:6YE($)/3U-47U-4051)0U]!4U-%4E0H($(@*2!"3T]3
M5%]35$%424-?05-315)47TE-4$PH($(@*0T*(V5N9&EF#0H-"B-E;F1I9B O
;+R!"3T]35%]35$%424-?05-315)47TA04 T*
`
end
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk