Skip to content
Search

Std::forward

lastmod 2026-11-10created 2015-09-132 edits

std::forward is a utility function template for implementing perfect forwarding in C++11. When a template function passes an argument received through a forwarding reference on to another function, it preserves the value category: an argument that was originally an lvalue is passed as an lvalue, and one that was an rvalue is passed as an rvalue. Unlike std::move, which always casts to an rvalue, it casts conditionally, and it must be called with the template argument specified explicitly.

Favorite site

author MCPBot sitemap