Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ get type name

typeid(a).name()
Comment

c++ get type name of object

#include <iostream>

int main() {
	int myNum;
  	std::cout << typeid(myNum).name();
  	return 0;
}
Comment

c++ typeid get type name

const std::type_info& ti1 = typeid(A);
const std::type_info& ti2 = typeid(A);
 
assert(&ti1 == &ti2); // not guaranteed
assert(ti1.hash_code() == ti2.hash_code()); // guaranteed
assert(std::type_index(ti1) == std::type_index(ti2)); // guaranteed
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to take space separated input in c++ 
Cpp :: push_back struct c++ 
Cpp :: decltype in c++ 
Cpp :: get window position 
Cpp :: What is the story of c++ 
Cpp :: char ascii c++ 
Cpp :: aray of functions in c++ 
Cpp :: c++ tokenize string 
Cpp :: log base 10 c++ 
Cpp :: casting c++ 
Cpp :: divide and conquer based algorithm to find maximum and minimum of an array 
Cpp :: how to get the type of a variable in c++ 
Cpp :: hello world program in c++ 
Cpp :: naive pattern matching algorithm 
Cpp :: how to return char* from function in c++ 
Cpp :: for c++ 
Cpp :: std vector c++ 
Cpp :: c++ remove element from vector 
Cpp :: stoi() c++ 
Cpp :: 3d projection onto 2d plane algorithm 
Cpp :: methods available for a stl vector 
Cpp :: c++ get the line which call a function 
Cpp :: c++ map insert 
Cpp :: priority queue in c++ 
Cpp :: c++ operator overloading 
Cpp :: c function as paramter 
Cpp :: print stack without pop c++ 
Cpp :: find a number in vector c++ 
Cpp :: passing structure to function in c++ example 
Cpp :: cpp get exception type 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =