1. It is recommended to use std::shared_ptr<taskt> instead of pointer taskt*, shared_ptr is a smart pointer, can be self-destruct free memory, introduced in C++11, in multithreaded programming has a great use, It can count how many pointers point to the same object. This class is included in the <memory>.
2. In a template class to use the iterator type of a container, the iterator type needs to be preceded by a typename to compile for an unknown reason.
3. As long as the iterator type in the container is not deleted, the content pointed to by iterator is constant, which allows for many callbacks to be deleted, while void* can point to the iterator address and can be used by the void* pointer callback.
4.typedef cannot redefine the template class, can redefine the determined type, how to redefine the type of template class, there is no good solution, seemingly can use template alias?
5. With regard to the use of functions in a template class, if it is such a function void cmp (int a,int b) points to him the function is function<void (int,int) > Func. The template class can redefine () to call a function through the class name, which generally requires a func (A, B).
6. For lamda expressions, for void cmp (int a,int b) {return a<b;} Can be written as an expression [] (int a, int b) {
Return a<b};
C++11 template class Usage experience