DEV Community

Seongcheol Jeon
Seongcheol Jeon

Posted on

[C++] std::forward

forward는 <utility> 헤더에 정의되어 있다.

template <class T>
constexpr T&& forward(std::remove_reference_t<T>& t) noexcept; // (1)

template <class T>
constexpr T&& forward(std::remove_reference_t<T>&& t) noexcept; // (2)
Enter fullscreen mode Exit fullscreen mode

(1) 오버로딩의 경우, lvalue를 T에 따라 lvalue 혹은 rvalue로 전달한다.

Top comments (0)