on a related not.
in the (templated) function taking a variant, I use the coerce() method which does some conversion (byte to int, for example)

the suggested code (while excellent, much thanks again!) is very stringent, doesn't allow for such implicit conversion

i.e. with
bool isTypeOf(TypeInfo ti1, TypeInfo ti2) { return ( ti1 is ti2 ); }

isTypeOf(typeid(byte), typeid(int)) will return false.

is there (I might be pushing it here, I know :P) a way to make it return true in such case??





"Mike Wey"  wrote in message news:ithv61$2j5t$1...@digitalmars.com...

On 06/18/2011 05:28 AM, Lloyd Dupont wrote:
ho... easy hey!
but how about the other 2 test I'd like be able to run?

bool isTypeOf(T)(TypeInfo ti) { "return T is ti" }
bool isTypeOf(TypeInfo ti1, TypeInfo ti2) { "return ti1 is ti2" }


bool isTypeOf(T)(TypeInfo ti)
{
    return ( typeid(T) is ti );
}

bool isTypeOf(TypeInfo ti1, TypeInfo ti2)
{
    return ( ti1 is ti2 );
}

--
Mike Wey

Reply via email to