Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting derived class pointer from the base class via CRTP

95 views
Skip to first unread message

asiflse

unread,
Apr 23, 2013, 2:29:51 AM4/23/13
to
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...@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
0 new messages