2 // { dg-do run { target c++11 } }
6 virtual void operator()() const = 0;
7 virtual func* clone() const = 0;
11 struct funcimpl : func {
12 explicit funcimpl(T t) : t(t) { }
13 void operator()() const { t(); }
14 func* clone() const { return new funcimpl(*this); }
23 function(T t) : p(new funcimpl<T>(t)) { }
25 ~function() { delete p; }
27 function(const function& f) : p(f.p->clone()) { }
29 function& operator=(const function& ) = delete;
31 void operator()() const { (*p)(); }
35 function animate(F f) { return [=]{ f(); }; }
39 function linear1 = []{};
40 function av(animate(linear1));