Last active
August 29, 2015 14:05
-
-
Save jia-kai/4705d3ab090cc79f1bb7 to your computer and use it in GitHub Desktop.
c++14 auto type deduction
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> | |
auto second_f(auto a, auto b) { | |
return b; | |
} | |
int main() { | |
auto second_l = [](auto a, auto b) {return b;}; | |
std::cout << second_f(0u, -1) << std::endl; | |
std::cout << second_l(0u, -1) << std::endl; | |
//std::cout << second_f("str", -1) << std::endl; // would not compile | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment