Difference between revisions of "CPP/Typeof"

From ProgrammingExamples
< CPP
Jump to: navigation, search
(Created page with '==Typeof.cpp== <source lang="cpp"> #include <iostream> #include <vector> int main(int, char*[]) { int a = 2; std::cout << a << std::endl; typeof(a) b = 3; std::cout …')
 
(No difference)

Latest revision as of 09:35, 5 December 2010

Typeof.cpp

#include <iostream>
#include <vector>
 
int main(int, char*[])
{
 
  int a = 2;
  std::cout << a << std::endl;
 
  typeof(a) b = 3;
  std::cout << b << std::endl;
 
  std::vector<typeof(a)> vec;
  vec.push_back(1);
  std::cout << vec[0] << std::endl;
  return 0;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
 
PROJECT(Typeof)
 
ADD_EXECUTABLE(Typeof Typeof.cpp )