I'm writing a simple universal pool. The template class takes a parameter in the constructor that is a factory function to instantiate objects in the pool as needed
template <typename T> class LIFOPool { std::function <T*()> factory_; //...details irrelevant public: LIFOPool(std::function<T*()> factory) : factory_(factory) {} //...details irrelevant };
This compiles fine, but I wanted to make a default argument for the constructor using lambda:
LIFOPool(std::function<T*()> factory = [](){return new T();} ) : factory_(factory) {}
It gives me error C2061: syntax error : identifier 'T'.
Now this compiles fine with gcc4.8. Is there a way to make lambdas aware of template parameters in VC13?