Notice
Recent Posts
Recent Comments
Link
«   2024/09   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Tags more
Archives
Today
Total
관리 메뉴

난 정말 최고야 멋있어

[C++] auto 와 decltype(auto)의 차이 본문

카테고리 없음

[C++] auto 와 decltype(auto)의 차이

n00bh4cker 2020. 1. 13. 15:35

http://www.cplusplus.com/forum/general/188645/

 

When to use decltype(auto) versus auto? - C++ Forum

When to use decltype(auto) versus auto? Hi, When and why is it necessary or convenient to use on return types or type deduction versus plain ? Thanks, Juan P.S.: I have read so much about this that I am more confused!! See http://www.cplusplus.com/forum/ge

www.cplusplus.com

 

auto -> 일반 auto는 레퍼런스같은걸 고려안하고 무조건 lvalue로 리턴

auto& -> 항상 레퍼런스로 연역

decltype(auto) -> 주어지는 값에 따라 알아서 판별 (레퍼런스를 넘기면 레퍼런스로 취급, lvalue를 넘기면 lvalue로 취급)