タグ

C++とc++0xに関するrydotのブックマーク (3)

  • C++0x メンバ関数のlvalue/rvalue修飾 - Faith and Brave - C++で遊ぼう

    C++03 では、右辺値に対して左辺値用のメンバ関数を呼べてしまいます。 class X { public: X& operator=(const X&) { ... } }; int main() { X x; X() = x; // エラーになるべきだが、コンパイルが通ってしまう } この問題を解決するため、 C++0x ではメンバ関数を & 、 && で修飾することができるようになり、そのオブジェクトが左辺値の場合だけ呼べる関数、右辺値の場合だけ呼べる関数を判別できるようになります。 class X { public: X& operator=(const X&) & // 左辺値修飾 { ... } }; int main() { X x; X() = x; // エラー! } また、オブジェクトが左辺値なのか右辺値なのかでメンバ関数をオーバーロードできるので、 左辺値だったらco

    C++0x メンバ関数のlvalue/rvalue修飾 - Faith and Brave - C++で遊ぼう
  • Page Redirection - GNU Project

    This page has been incorporated into another. If you are not redirected automatically, click here. For questions related to the use of GCC, please consult these web pages and the GCC manuals. If that fails, the gcc-help@gcc.gnu.org mailing list might help. Comments on these web pages and the development of GCC are welcome on our developer list at gcc@gcc.gnu.org. All of our lists have public archi

  • C++0xにすごい変更が来た

    Batavia会議は、だいぶ興味深いことになった。詳しくは、正式なNのペーパーが出てから解説するが、とにかく、非常に重要な項目をふたつだけ解説する。 まず、attributeによって提供されていた多くのクラスのメンバーに関する機能は、キーワードを与えられた。これは、言語機能は、特別な文法を与えるに値するという思想からである。会議でコンセンサスの得られた文法は以下の通りである。 struct Base { virtual void f() { } int x ; } ; struct Derived final explicit : Base { virtual void f() override { } int x new ; } ; 機能はattributeで提供されていたものと全く変わらないので、説明は省く。変更点としては、base_checkのかわりにexplicitを使い、hidi

  • 1