LINUX.ORG.RU

История изменений

Исправление KennyMinigun, (текущая версия) :

class Foo {
public:
// ...
  Foo &e() {
    std::cout << "1 ";
    return *this;
  }
  Foo &d() {
    std::cout << "2 ";
    return *this; 
  } 
};

Foo().e().d(); // works

https://wandbox.org/permlink/EZi6ZhHQox78EP88

Исправление KennyMinigun, :

class Foo {
public:
// ...
  Foo &e() {
    std::cout << "1 ";
    return *this;
  }
  Foo &d() {
    std::cout << "2 ";
    return *this; 
  } 
};

https://wandbox.org/permlink/EZi6ZhHQox78EP88

Исходная версия KennyMinigun, :

class Foo {
public:
// ...
  Foo &e() {
    std::cout << "1 ";
    return *this;
  }
  Foo &d() {
    std::cout << "2 ";
    return *this; 
  } 
};

https://wandbox.org/permlink/EZi6ZhHQox78EP88