Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

std::forward

Language

C++

Compiler

gcc 13.2.0

Options
Warnings
Boost 1.83.0
C++11
no pedantic

std::forward

$ g++ prog.cc -Wall -Wextra -I/opt/wandbox/boost-1.83.0-gcc-13.2.0/include -std=c++11
prog.cc: In instantiation of 'void Tprint(T&&) [with T = int&]':
prog.cc:53:11:   required from here
prog.cc:30:17: warning: unused parameter 't' [-Wunused-parameter]
   30 | void Tprint(T&& t)
      |             ~~~~^
int a: type is int
const int b: type is int const
int& lref: type is int&
int&& rref: type is int&&
Tprint:std::is_same<int &, T>():1
forward(&&):std::is_same<int, _Tp>():1
forward(&&):std::is_same<int&&, _Tp>():0
run _Tp&&
forward<int>(lref): type is int&&
forward<int &>(lref): type is int&
forward(&):std::is_same<int, _Tp>():1
forward(&):std::is_same<int&, _Tp>():0
forward(&):std::is_same<int&&, _Tp>():0
run _Tp&
Exit Code:
0