Title: [Question] Item 24 - Universal Reference 와 Rvalue Reference를 구별하라 · Issue #5 · lunchclass/cpp · GitHub
Open Graph Title: [Question] Item 24 - Universal Reference 와 Rvalue Reference를 구별하라 · Issue #5 · lunchclass/cpp
X Title: [Question] Item 24 - Universal Reference 와 Rvalue Reference를 구별하라 · Issue #5 · lunchclass/cpp
Description: Item 24의 내용 중 아래와 같은 내용이 나옵니다. Even the simple presence of a const qualifier is enough to disqualify a reference from being universal: template
Open Graph Description: Item 24의 내용 중 아래와 같은 내용이 나옵니다. Even the simple presence of a const qualifier is enough to disqualify a reference from being universal: template
X Description: Item 24의 내용 중 아래와 같은 내용이 나옵니다. Even the simple presence of a const qualifier is enough to disqualify a reference from being universal: template<typename T> void f(const T&& param); //...
Opengraph URL: https://github.com/lunchclass/cpp/issues/5
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Question] Item 24 - Universal Reference 와 Rvalue Reference를 구별하라","articleBody":"Item 24의 내용 중 아래와 같은 내용이 나옵니다.\r\n\u003e\u003eEven the simple presence of a const qualifier is enough to disqualify a reference from being universal:\r\n\u003e\u003e```c++\r\n\u003e\u003etemplate\u003ctypename T\u003e \r\n\u003e\u003evoid f(const T\u0026\u0026 param); // param is an rvalue reference\r\n\u003e\u003e```\r\n그런데 이유는 전혀 나오지 않습니다.\r\n저자는 단지 \"Universal reference(== forwarding reference) 는 반드시 type deduction 이 있으면서 \"T\u0026\u0026\" 형태가 아니면 Universal reference 가 안된다\" 라고만 설명하고 있습니다.\r\n[Scott mayers 의 다른 article](https://isocpp.org/blog/2012/11/universal-references-in-c11-scott-meyers)\r\n\r\nStackOverflow 에서도 동일한 의문을 제기하는 글이 있습니다.\r\n[https://stackoverflow.com/questions/38814939/why-adding-const-makes-the-universal-reference-as-rvalue](https://stackoverflow.com/questions/38814939/why-adding-const-makes-the-universal-reference-as-rvalue)\r\n답변에 따르면 먼저 표준에는 forwarding reference 의 정의 자체가 \"A forwarding reference is an rvalue reference to a cv-unqualified template parameter\"로 const 가 없는 Rvalue reference 형태라고 되어 있습니다. 그리고 이렇게 한 이유는 const T\u0026\u0026 도 universal reference 로 허용하게 되면 rvalue 만 받고자 하는 함수 overloading 을 만들 수가 없기 때문이라고 설명하고 있습니다.\r\n\u003e\u003eThe problem is that we would have no way to overload a template function who takes only rvalue reference as parameter if both T \u0026\u0026 and const T \u0026\u0026 are allowed to use as forwarding references. – Carousel \r\n\r\n* 추후 업데이트 필요","author":{"url":"https://github.com/JayCheck","@type":"Person","name":"JayCheck"},"datePublished":"2017-09-04T15:14:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/5/cpp/issues/5"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c150aa45-de13-d04d-9bde-e8478f34b5c6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 91D8:45332:43F2AD:57D5C5:697FA744 |
| html-safe-nonce | f6e8fa03e53c34d02aaff2e378ca3c0ac067fcf3da40302a8779df0709ebc293 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MUQ4OjQ1MzMyOjQzRjJBRDo1N0Q1QzU6Njk3RkE3NDQiLCJ2aXNpdG9yX2lkIjoiNzAxMDMwOTc1OTA0NzgwNDc0MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7fb56c2469996aedfdd09586659159b747fc69460abbec3cb25d4fa84f5e52ff |
| hovercard-subject-tag | issue:255069212 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/lunchclass/cpp/5/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4c2dd99cb13db465747df2f3fef1a2dd9912d9de74227cff5ccd5185f7146f75/lunchclass/cpp/issues/5 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4c2dd99cb13db465747df2f3fef1a2dd9912d9de74227cff5ccd5185f7146f75/lunchclass/cpp/issues/5 |
| og:image:alt | Item 24의 내용 중 아래와 같은 내용이 나옵니다. Even the simple presence of a const qualifier is enough to disqualify a reference from being universal: template |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JayCheck |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60279d4097367e16897439d16d6bbe4180663db828c666eeed2656988ffe59f6 |
| turbo-cache-control | no-preview |
| go-import | github.com/lunchclass/cpp git https://github.com/lunchclass/cpp.git |
| octolytics-dimension-user_id | 29477287 |
| octolytics-dimension-user_login | lunchclass |
| octolytics-dimension-repository_id | 99764040 |
| octolytics-dimension-repository_nwo | lunchclass/cpp |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 99764040 |
| octolytics-dimension-repository_network_root_nwo | lunchclass/cpp |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7c85641c598ad130c74f7bcc27f58575cac69551 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width