Topic: Getting derived class pointer from the base class via CRTP
Author: asiflse <asif.lse2@googlemail.com>
Date: Mon, 22 Apr 2013 23:29:51 -0700 (PDT)
Raw View
Hi,
I am having to make my base class a template because I want a function in it that the users can call to get pointer to the derived class (or that my own template library can call to get pointer to the derived class). I do it by making my base class a curious base. Now users just pass their derived classes as template parameters to my base class that enables my library to run correctly as it can get the derived class pointer. But that's the only use of CRTP in my library. Can you recommend any other clean alternatives?
Best regards,
-AS
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]