tags:
- Cpp
Functions in Standard Library (Examples)
#include <iostream>
#include <typeinfo>
int main(){
int x = 10;
std::cout << "x type: " << typeid(x).name() << std::endl;
return 0;
}
check if a variable is const type
#include <iostream>
#include <type_traits>
int main(){
int x = 10;
std::cout << std::is_const_v<decltype(x)> <<std::endl; //C++17
//or
std::cout << std::is_const<decltype(x)>::value << std::endl;
return 0;
}