Aug 12, 2018

[C++][recap] forward

https://en.cppreference.com/w/cpp/utility/forward


Perfect forwarding isn't really perfect. There are several kinds of arguments that cannot be perfectly forwarded, including (but not necessarily limited to):

  • 0 as a null pointer constant.
  • Names of function templates (e.g., std::endl and other manipulators).
  • Braced initializer lists.
  • In-class initialized const static data members lacking an out-of-class definition.
  • Bit fields.

For details consult the comp.std.c++ discussion, “ Perfect Forwarding Failure Cases,”referenced in the Further Information section of the course.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.