Skip to content

Instantly share code, notes, and snippets.

@Piyush3dB
Created September 11, 2015 07:54
Show Gist options
  • Save Piyush3dB/b9cd9272e5e6f3756244 to your computer and use it in GitHub Desktop.
Save Piyush3dB/b9cd9272e5e6f3756244 to your computer and use it in GitHub Desktop.
Short program to test if g++ supports few C++ 11 features.
#include <iostream>
using namespace std;
int main()
{
int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
for(auto i : arr){
cout << arr[i] <<endl;
}
return 0;
}
// you can check if you have a modern compiler by the code above which uses some c++11 only features like:
// 1. initializer list
// 2. auto type
// 3. ranged based for loop
/*
Compile with:
g++ -std=c++0x -o main.0 main.cpp
g++ -std=c++11 -o main.0 main.cpp
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment