C++11/C++0x 15
■ このスレッドは過去ログ倉庫に格納されています
0045デフォルトの名無しさん
2011/11/20(日) 07:16:47.638.3.2の↓をアホな僕にわかるよう誰か説明してもらえんでしょうか。
If a typedef (7.1.3), a type template-parameter (14.3.1), or a decltype-specifier (7.1.6.2) denotes a type TR
that is a reference to a type T, an attempt to create the type “lvalue reference to cv TR” creates the type
“lvalue reference to T”, while an attempt to create the type “rvalue reference to cv TR” creates the type TR.
void f(int &&a)のaは必ずint &&だけど、
template<typename T> void f(T &&a)に右辺値(0など)を渡すとaはT &&で
template<typename T> void f(T &&a)に左辺値(変数)を渡すとaはT &になる。何ですかコレ?
■ このスレッドは過去ログ倉庫に格納されています