Tag Archive: rvalue-references


幾個月前曾在一篇文字裡寫道: 正確的運用 Rvalue References, 有可能帶來可觀的 performance gain. 前幾天看到 Visual C++ Team Blog 新貼出對 STL (VS2010 vs. VS2008) 的 performance benchmark. 在一個程度上, 該篇文字可以說驗證了這個不只我一個人獨有的看法與對 C++0x 的期待.

Rvalue-References 帶來的 performance boost 或許比不上 Multi-Core STL 來得那麼 “方便”, 但絕對是你不會想要錯過的 low hanging fruit.

C++0x 的巨浪就要來了, 你準備好了嗎?

喜愛 C++ 並關心 C++0x 標準的朋友一定會知道, C++0x 引進了許多新的元素. 不但對 Standard Library 有為數眾多的 addition 與 enhancement, 連 core language 都新增了不少東西. 而其中最重要的, 在我看來, 就是 Rvalue References. 即便不理會 C++0x 其他的新玩意 Rvalue References 依然是一個職業 C++ programmer 該要掌握的新 feature. 原因很簡單, 正確的運用 Rvalue References, 有可能帶來可觀的 performance gain.
View full article »

上一篇 的主題是 Rvalue References 的語意/語法與功能, 這篇要補完同樣是關於 Rvalue References, 但較為瑣碎的細節.
View full article »

Intro

Rvalue-References 是 C++0x 規範的新 language feature, 也是繼 Templates 後, IMO, C++ 語言最重要的 language feature. 其目的是為了支持 Move Semantics — 將 resource 從一個 instance 轉移到另一個 instance.

Rvalue — 這個聽起來饒舌的新名詞 — 說穿了其實就是 un-named instance (i.e. temporary), 反之, 有名字的 (named) 則為 lvalue. 而 const/volatile 與否則是額外的修飾. 也就是說, 一個 rvalue reference 其實就是 reference to a temporary.
View full article »

I recently came across a mistake in The rvalue Reference Proposal published in Informit‘s C++ Reference Guide.

View full article »