Skip to content

Instantly share code, notes, and snippets.

@windoze
Created May 28, 2015 05:52
Show Gist options
  • Save windoze/865eaf7910f878c63e06 to your computer and use it in GitHub Desktop.
Save windoze/865eaf7910f878c63e06 to your computer and use it in GitHub Desktop.
VC Quirks 1
#include <iostream>
#include <functional>
typedef std::function<int(int)> fii;
template<typename Fn>
auto f(Fn fn)
-> typename std::enable_if<!std::is_constructible<fii, Fn>::value, int>::type
{ return 10; }
int f(fii) { return 20; }
int xx(int, int) { return 0; }
int main() {
std::cout<< f(xx) << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment