Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) TypeidExample1

 

Technical facts

 

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: ./CppTypeidExample1/CppTypeidExample1.pro

 

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp

QMAKE_CXXFLAGS += -std=c++11 -Wall -Wextra -Weffc++
unix {
  QMAKE_CXXFLAGS += -Werror
}

 

 

 

 

 

./CppTypeidExample1/main.cpp

 

#include <cassert>
#include <string>
#include <typeinfo>

int main()
{
  assert(std::string(typeid(int).name())=="i");
  assert(std::string(typeid(double).name())=="d");
  assert(std::string(typeid(std::string).name())=="Ss");
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml