Learn template by math vector class

Brad Roberts braddr at puremagic.com
Thu Jun 22 00:58:41 PDT 2006


On Thu, 22 Jun 2006, Hasan Aljudy wrote:

> I think you can use static if:
> 
> static if( size < 3 ) //no z component
> {
>     pragma( msg, "2d vectors don't have a z component" ); //tell compiler to
> print this msg
>     static assert(false); //halt compiler
> }

Or the even simpler:

static assert(size < 3, "2d vectors...");

Later,
Brad



More information about the Digitalmars-d-learn mailing list