跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • C++ 常量右值有没有啥意义?
未分類
12 9 月 2020

C++ 常量右值有没有啥意义?

C++ 常量右值有没有啥意义?

資深大佬 : by73 3

例如 void f(const T&& val) 这样的常量右值,虽然编译能通过,但总觉得语义上怪怪的,就想问问这种写法到底有没有意义,还是只是单纯的因为 reference collapsing 所以才保留这种写法?

(日常水,轻喷。。

大佬有話說 (3)

  • 資深大佬 : dangyuluo

    The semantics of getting a const rvalue reference (and not for =delete) is for saying:

    1. we do not support the operation for lvalues!
    2. even though, we still copy, because we can’t move the passed resource, or because there is no actual meaning for “moving” it.

    真纠结

  • 資深大佬 : amosasas

    @dangyuluo C++的日常…

  • 資深大佬 : Wirbelwind

    没什么意义,有时候可以阻止重载

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具