template
private:
T t; // wrapped object
::: // wrapper-specific state
public:
wrap( T t_ = T{} ) : t{t_} { }
template
auto operator()( F f ) -> decltype(f(t)) { // strategy: take any code (!)
// wrapper work
auto ret = f(t); // pass the wrapped object to it
// more wrapper work
return ret; // and return the result
}
From Herbs talk : video link
Slides (Example above from page 9)