这两者有区别吗
struct S; int& foo(S&); auto&& bar1(S& s) { return foo(s); } decltype(auto) bar2(S& s) { return foo(s); }
对于编译器?我一直在这样decltype(auto)的情况下使用,但似乎auto&&可以解决问题。这是巧合还是两者完全相同?
decltype(auto)
auto&&
c++ c++14 forwarding-reference
c++ ×1
c++14 ×1
forwarding-reference ×1