[type_traits] is_function
Assuming a compiler supports is_function, will this metafunction check for the presence of member functions in a class? For example: struct Foo { void bar(); }; struct Baz { }; Given the right template argument, will is_function detect the bar() function in Foo but return false_ for Baz? If so, what is the right template argument? If not, are there any known workarounds? Cromwell D. Enage ____________________________________________________________________________________ Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains. http://farechase.yahoo.com/promo-generic-14795097
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday 28 February 2007 15:05 pm, Cromwell Enage wrote:
Assuming a compiler supports is_function, will this metafunction check for the presence of member functions in a class? For example:
struct Foo { void bar(); };
struct Baz { };
Given the right template argument, will is_function detect the bar() function in Foo but return false_ for Baz? If so, what is the right template argument? If
I think it will return false for both. Maybe "is_member_function_pointer" would be more useful for you? - -- Frank -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFF5evU5vihyNWuA4URAs6eAKDoO/wV9Vb+fUuNw07AMN6vbZvl+wCg30R0 BrmuZN6Nv4lwV9hVohsJvl8= =Wu0v -----END PGP SIGNATURE-----
--- Frank Mori Hess wrote:
Cromwell Enage wrote:
Assuming a compiler supports is_function, will this metafunction check for the presence of member functions in a class? For example:
struct Foo { void bar(); };
struct Baz { };
Given the right template argument, will is_function detect the bar() function in Foo but return false_ for Baz? If so, what is the right template argument?
I think it will return false for both. Maybe "is_member_function_pointer" would be more useful for you?
is_member_function_pointer will not compile if bar is not a member of Baz. However, if I can find a way to detect whether bar is a member of Baz, then I can use is_member_function_pointer in conjunction with BOOST_TYPEOF. The question now is, does such a method exist? Cromwell D. Enage ____________________________________________________________________________________ Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html
participants (2)
-
Cromwell Enage
-
Frank Mori Hess