Created
December 4, 2015 08:16
-
-
Save Bigpet/7269ebac58b3d34f7b8d to your computer and use it in GitHub Desktop.
VS is trolling me
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 <type_traits> | |
#include <iostream> | |
#include <array> | |
template<typename T> | |
auto func(const T& t) -> typename std::common_type<float, T>::type | |
{ | |
return 5.0f + t; | |
} | |
float func(const std::array<float,3>& t) | |
{ | |
return 5.0f + t[0]; | |
} | |
int test() | |
{ | |
std::array<float,3> c{ {1,2,3} }; | |
auto b = func(5); | |
auto d = func(c); | |
std::cout << b << std::endl; | |
std::cout << d << std::endl; | |
} | |
int main() | |
{ | |
test(); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment