My code is supposed to determine whether the given function takes the type given in the form of parameters. To answer your future "What" questions I will answer shortly: Use it with the The code is used by C ++ 11's decltype operator. My question is, is it possible to achieve the same goal using C ++ 03? The error is: I think you do this Through, you can also use the symptoms of Boost type. itemprop = "text">
boost :: enable_if template.
#include & lt; Iostream & gt; Template & lt; Class F, Class P & gt; Struct has_arg_of_type {static bull console value = false; }; Template & lt; Class R, Class A & gt; Straight is_g_off_type & lt; R (A), A & gt; {Fixed Boolecast value = true; }; Template & lt; Class R, Class T, Class A & gt; Struct has_arg_of_type & lt; R (T: *) (A), A & gt; {Fixed Boolecast value = true; }; Int pizz (int); Classes Mylals {public: zero pins (int); }; Int main (int argc, char * argv []) {std :: cout & lt; & Lt; "Does MySlass :: Piez has an argument as a logic?" & Lt; & Lt; Has_arg_of_type & lt; Decltype (& MyClass :: pisz), interval & gt; :: value & lt; & Lt; Std :: endl; // line32 std :: cout & lt; & Lt; "Is pizza an integer in the form of a logic?" & Lt; & Lt; Has_arg_of_type & lt; Decltype (pisz), int & gt; :: value & lt; & Lt; Std :: endl; Std :: cout & lt; & Lt; "Is float in the form of a pizza in a pizza?" & Lt; & Lt; Has_arg_of_type & lt; Decltype (pisz), float & gt; :: value & lt; & Lt; Std :: endl; Return 0; }
in the function 'int main (int, char **)': line 32: error: 'MyClass :: pisz Int) can not be displayed in continuous expression
#include & lt; Iostream & gt; #include & lt; Boost / function_types / function_type.hpp & gt; # Include & lt; Boost / function_types / parameter_types.hpp & gt; #include & lt; Boost / typeof / std / utility.hpp & gt; Float pizz (int); Classes Mylals {public: zero pins (int); }; Int main (int argc, char * argv []) {typedef BOOST_TYPEOF (& MyClass :: pisz) MyClassPisz; Typing BOOSTEOEOOO (Peace) piece; Typedef boost :: ml :: at_c & lt; Boost :: function_types :: parameter_type & lt; MyClassPisz>, 1 & gt; :: type member work; Typedef boost :: ml :: at_c & lt; Boost :: function_types :: parameter_types & lt; Pisz>, 0 & gt; :: type function; Std :: cout & lt; & Lt; "Does MySlass :: Piez has an argument as a logic?" & Lt; & Lt; Promotion: is_same & lt; Member Function, At & GT; :: value & lt; & Lt; Std :: endl; Std :: cout & lt; & Lt; "Is pizza an integer in the form of a logic?" & Lt; & Lt; Promotion: is_same & lt; Function, At & G; :: Price & lt; & Lt; Std :: endl; Std :: cout & lt; & Lt; "Is float in the form of a pizza in a pizza?" & Lt; & Lt; Promotion: is_same & lt; Function, float & gt; :: value & lt; & Lt; Std :: endl; Return 0; }
Wednesday, 15 August 2012
c++ - Function argument type -
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment