Showing posts with label cpp_tmp_forward. Show all posts
Showing posts with label cpp_tmp_forward. Show all posts

Jul 8, 2022

[C++] inline std::forward impl

Reference:
https://github.com/fmtlib/fmt/blob/b761f1279e2dfb950a7bf9ff7128d6b03b77b013/include/fmt/core.h#L204
https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html

{fmt}/core.h itself contains nice coding tips/idea

inline std::forward impl
i.e.
// An inline std::forward replacement.
#define FMT_FORWARD(...) static_cast<decltype(__VA_ARGS__)&&>(__VA_ARGS__)