c++ - find out the type of auto -
I am playing with normal lambda in C ++ 1 and I often do not know what kind of code > Auto variable / parameter is there a good way to detect it?
Currently I am using Example: output I have to know mainly that it is the value that the parameter is passed by a new value ref / revue ref / value etc. And I am using Xcode 5.1.1 GCC function Use: typeit (decltype (arg)). but it is not very useful
Auto F = [] (Auto & amp; A, Auto B) {std :: Cout & lt; & Lt; Std :: endl; Std :: cout & lt; & Lt; Typed (Deltaipip (A)). Name () & lt; & Lt; Std :: endl & lt; & Lt; @ Encoded (manifesto (a)) & lt; & Lt; Std :: endl; Std :: cout & lt; & Lt; Typed (delftype (b)). Name () & lt; & Lt; Std :: endl & lt; & Lt; @ Encode (declaration (b)) & lt; & Lt; Std :: endl; }; Int i = 1; F (I, I); F (1, 1); F (std :: make_unique & lt; int & gt; (2), std :: make_unique & lt; int & gt; (2)); AutoContactTr = STD :: MacConnect & lt; Int & gt; (); F (PTR, encryptor);
i // It does not tell me that the reference ^ i // ^ means the pointer, but this is actually the reference, though Some indicators Iii ^ iii NSt3__110unique_ptrIiNS_14default_deleteIiEEEE ^ {unique_ptr & lt; Int, std :: __ 1 :: default_delete & lt; Int & gt; & Gt; = {__ compressed_pair & lt; Int *, std :: __ 1 :: default_delete & lt; Int & gt; & Gt; = ^ I}} NSt3__110unique_ptrIiNS_14default_deleteIiEEEE {unique_ptr & lt; Int, std :: __ 1 :: default_delete & lt; Int & gt; & Gt; = {__ compressed_pair & lt; Int *, std :: __ 1 :: default_delete & lt; Int & gt; & Gt; = ^ I}} NSt3__110unique_ptrIiNS_14default_deleteIiEEEE r ^ {unique_ptr & lt; Int, std :: __ 1 :: default_delete & lt; Int & gt; & Gt; = {__ compressed_pair & lt; Int *, std :: __ 1 :: default_delete & lt; Int & gt; & Gt; == i}} DN *
std :: string demangled (std :: string const & sym) {std :: unique_ptr & lt; Char, void (*) (zero *)> Name {abi :: __ cxa_demangle (sym.c_str (), nullptr, nullptr, nullptr), std :: free}; Return {name.get ()}; } Auto F = [] (Auto & A, Auto B) {std :: cout & lt; & Lt; Name ()) & lt; & Lt; Demangled (decltype (a)). '\ N'; Std :: cout & lt; name ())
Comments
Post a Comment