0

Template argument type

I was just trying to print whether argument is map or unordered map. It is showing but with some random numbers. Is there any other way ? I remember something related to ::value but can't recall perfectly what it was... Any help on this ? https://code.sololearn.com/c95YJ40vw531/?ref=app

7th Jun 2021, 8:36 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Réponse
+ 4
The name of a type returned from typeid() is implementation specific, but you can demangle it. Here is an example by another user: https://code.sololearn.com/ccr76hQ048un/?ref=app Otherwise you would probably have to specialize the function template for whatever types you want to print, or perform type traits comparisons via std::is_same<>, which is somewhat tedious.
7th Jun 2021, 9:00 PM
Shadow
Shadow - avatar