request: plz add operator() to mpl::true_ and mpl::false_

plz add operator() to mpl::true_ and mpl_::false let us consider the following case. struct foo{}; template<typename T> struct is_foo_traits : boost::mpl::false_ {}; template<> struct is_foo_traits<foo> : boost::mpl::true_ {}; template<typename T> bool is_foo(const T& dummy){return false;} template<> bool is_foo<foo>(const foo& dummy){return true;} void main() { using namespace boost; using namespace std; foo myfoo; cout << is_foo(myfoo) << endl;//true cout << is_foo(12) << endl;//false cout << is_foo_traits<foo>::value << endl;//true cout << is_foo_traits<int>::value << endl;//false } In this case, we need to define same thing two times. However if mpl::true_ have operator() as like mpl::true_ { template<typename T> bool operator()(const T & dummy){return true;} }; We can remove one line using: template<typename T> bool is_foo(const T& dummy){return is_foo_traits<T>::value;}

AMDG On 08/12/2012 11:15 AM, Niitsuma Hirotaka wrote:
<snip>
In this case, we need to define same thing two times. However if mpl::true_ have operator() as like
mpl::true_ { template<typename T> bool operator()(const T & dummy){return true;} };
We can remove one line using:
template<typename T> bool is_foo(const T& dummy){return is_foo_traits<T>::value;}
??? I don't see how you're using operator() and I really don't think it's a good idea to add such an arbitrary function, anyway. In Christ, Steven Watanabe
participants (2)
-
Niitsuma Hirotaka
-
Steven Watanabe