Created
June 25, 2012 11:24
-
-
Save joelreymont/2988045 to your computer and use it in GitHub Desktop.
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
// xcrun clang++ -std=c++11 -stdlib=libc++ | |
#include <tuple> | |
#include <iostream> | |
using namespace std; | |
tuple<int, int> minmax(int x, int y) | |
{ | |
if (x <= y) | |
return { x, y} | |
else | |
return { y, x }; | |
} | |
int main(int argc, char* argv[]) | |
{ | |
int a, b; | |
tie(a, b) = minmax(10, 20); | |
cout << "a = " << a << ", b = " << b << endl; | |
return 0; | |
} |
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
biggie:tmp joelr$ xcrun clang++ -std=c++11 -stdlib=libc++ foo.cpp | |
foo.cpp:11:12: error: chosen constructor is explicit in copy-initialization | |
return { x, y} | |
^~~~~~~ | |
/Applications/Xcode45-DP1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:569:9: note: | |
constructor declared here | |
tuple(_Up&&... __u) | |
^ | |
foo.cpp:13:12: error: chosen constructor is explicit in copy-initialization | |
return { y, x }; | |
^~~~~~~~ | |
/Applications/Xcode45-DP1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:569:9: note: | |
constructor declared here | |
tuple(_Up&&... __u) | |
^ | |
2 errors generated. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment