$ g++ -o main main.cc
main.cc: In member function ‘void DataProcessor<T, P>::process() [with T = int, P = PrintData*]’:
main.cc:56: instantiated from here
main.cc:23: error: request for member ‘process’ in ‘((DataProcessor<int, PrintData*>*)this)->DataProcessor<int, PrintData*>::mProcessor’, which is of non-class type ‘PrintData*’
For typename T if i use int* this is to avoid copy of int (usefull if int is a bigger structure like a class) i would like the same behaviour with typename P.
You have to change the implementation. The best you can do is use some meta-programming construct to detect whether a pointer was passed in as the parameter and act accordingly. See Alexandrescu's Loki.
It's only the ownership of the processor that's parameterised. The interface allows you to specify at run-time whether DataProcessor owns the processor or not. But that's not a compile-time decision. It would only make sense to go further if you parameterised DataProcessor at compile-time.