|
Boost Users : |
Subject: [Boost-users] Comparing is_pointer with true_
From: jean-louis.a.leroy_at_[hidden]
Date: 2009-01-16 07:00:00
Hello.
I need to compare is_const<T> with true_ or false_. I don't find an easy way to do it. I have tried:
void foo(mpl::true_) { cout << "true" << endl; }
void foo(mpl::false_) { cout << "false" << endl; }
int _tmain(int argc, _TCHAR* argv[])
{
foo(is_same< mpl::true_, is_pointer<void*>() >());
foo(is_same< mpl::true_, is_pointer<void*>::type() >());
foo(is_convertible< is_pointer<void*>(), mpl::true_ >());
foo(is_base_of< mpl::true_, is_pointer<void*>() >());
return 0;
}
(in case you wonder why I don't simply pass is_pointer to foo(), here's why: I have a function object that is called twice with a bool_ template argument; the first time it handles all non-pointer types and in a second pass it handles the pointer types; in fact I'm trying to implement the equivalent of b1 == b2, where b1 and b2 are bools).
I understand that is_pointer<T> derives either from true_type or false_type. Thus it's normal that is_same fails. But what of the others?
Jean-Louis
= = = = = = = = = = = = = = = = = = = = = = = = =
Fortis disclaimer :
http://www.fortis.be/legal/disclaimer.htm
Privacy policy related to banking activities of Fortis:
http://www.fortis.be/legal/privacy_policy.htm
= = = = = = = = = = = = = = = = = = = = = = = = =
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net