Wraps an expression with 'std::ref' if it is available.