- C++相談室 part116 [転載禁止]©2ch.net
652 :デフォルトの名無しさん[]:2015/04/20(月) 09:45:06.44 ID:dQWHCrXK - #include <iostream>
using namespace std; template<typename T> struct C{ using type=long; }; template<> struct C<int>{ using type=float; }; template<typename T> using B=typename C<T>::type; template<typename T> auto f(B<T>& x){cout <<"A"<<endl;} int main() { B<int> x; f(x); float y; f(y); return 0; } なぜマッチしてると思うのにマッチしてないエラーになるんですか?
| - C++相談室 part116 [転載禁止]©2ch.net
654 :デフォルトの名無しさん[]:2015/04/20(月) 15:01:25.44 ID:dQWHCrXK - #include <iostream>
#include <array> using namespace std; struct A{ constexpr static auto f()->array<int,1>{ return array<int,1>{999}; } constexpr static array<int,1> a=f(); }; constexpr array<int,1> A::a; int main() { A a; cout<<a.a[0]<<endl; return 0; } >>626の続きでここまで考えたけど分かりません 教えてください
|
|