std.traits : Select - could it be better?

SrMordred patric.dexheimer at gmail.com
Thu Jul 5 18:50:42 UTC 2018


alias U = Select!( isPointer!T, PointerTarget!T, T );

This don´t compile if T are not a pointer;

so you have to do this:

static if( isPointer!T )
     alias U = PointerTarget!T;
else
     alias U = T;

Shouldnt the 'correct' way of Select to work is ignoring the 
choice that was not taken?

I love the idea of Select, but because of this I almost never use 
it.


More information about the Digitalmars-d mailing list