Created
August 29, 2012 08:59
-
-
Save kaorun55/3508814 to your computer and use it in GitHub Desktop.
C++11-2
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> | |
#include <vector> | |
unsigned long long int operator "" _twice ( unsigned long long int value ) | |
{ | |
return value * 2 ; | |
} | |
int operator "" _sec ( unsigned long long int value ) | |
{ | |
return value * 1000 ; | |
} | |
int main() | |
{ | |
std::cout << "10sec = " << 10_sec << "msec" << std::endl; | |
int a[] = { 1, 2, 3, 5, 8 }; | |
for ( auto i : a ) { | |
std::cout << i << " "; | |
} | |
std::cout << std::endl; | |
std::vector<int> v = { 1, 2, 3, 5, 8 }; | |
for ( auto i : v ) { | |
std::cout << i << " "; | |
} | |
std::cout << std::endl; | |
for ( auto i : { 1, 2, 3, 5, 8 } ) { | |
std::cout << i << " "; | |
} | |
std::cout << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment