fork(2) download
  1. #include <set>
  2. #include <functional>
  3. struct A {
  4. int a;
  5. // 以下の mutable と const は外すとコンパイルエラー
  6. mutable std::function<const A*()> f;
  7. A(int a) : a(a) { }
  8. bool operator<(A x) const { return a < x.a; }
  9. };
  10. int main() {
  11. std::set<A> S;
  12. std::set<A>::iterator x = S.insert(A(0)).first;
  13. x->f = [&] { return &*x; };
  14. }
  15.  
  16.  
Success #stdin #stdout 0s 4360KB
stdin
Standard input is empty
stdout
Standard output is empty