std::forward without perfect forwarding?
问题 Advice on std::forward is generally limited to the canonical use case of perfectly forwarding function template arguments; some commentators go so far as to say this is the only valid use of std::forward . But consider code like this: // Temporarily holds a value of type T, which may be a reference or ordinary // copyable/movable value. template <typename T> class ValueHolder { public: ValueHolder(T value) : value_(std::forward<T>(value)) { } T Release() { T result = std::forward<T>(value_);