Created
September 11, 2015 07:54
-
-
Save Piyush3dB/b9cd9272e5e6f3756244 to your computer and use it in GitHub Desktop.
Short program to test if g++ supports few C++ 11 features.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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