is expression with static if matches wrong type

ZombineDev via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 24 07:46:51 PDT 2015


On Saturday, 23 May 2015 at 04:40:28 UTC, tcak wrote:
> [snip]

Yup, you need to use == to match the exact type.
Btw, you can use enum templates from std.traits, to accomplish 
the same with less code:

public void setMarker(M)( size_t markerIndex, M markerValue )
	if(isScalarType!M)
{
     //...
}

http://dlang.org/phobos/std_traits.html#isScalarType


More information about the Digitalmars-d-learn mailing list