Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7858727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:34:39+00:00 2026-06-02T21:34:39+00:00

Regarding CRP if I want to implement a slight variation of it (using template

  • 0

Regarding CRP if I want to implement a slight variation of it (using template template parameter) I get a compile error:

template <template <typename T> class Derived>
class Base
{
public:
    void CallDerived()
    {
        Derived* pT = static_cast<Derived*> (this);
        pT->Action(); // instantiation invocation error here
    }
};

template<typename T>
class Derived: public Base<Derived>
{
public:
    void Action()
    {
    }
};

I am not exactly sure one would chose this form (that does not compile for me) instead of using this though (this works)

template <typename Derived>
class Base
{
public:
    void CallDerived()
    {
        Derived* pT = static_cast<Derived*> (this);
        pT->Action();
    }
};

template<typename T>
class Derived: public Base<Derived<T>>
{
public:
    void Action()
    {
    }
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T21:34:41+00:00Added an answer on June 2, 2026 at 9:34 pm

    This should compile as well. We just need to get the other template parameter specified explicitly

     template <typename T, template <typename T> class Derived>
     class Base
     {
     public:
         void CallDerived()
         {
            Derived<T>* pT = static_cast<Derived<T>*> (this);
            pT->Action(); // instantiation invocation error here
         }
     };
    
    template<typename T>
    class Derived: public Base<T,Derived>
    {
    public:
        void Action()
        {
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

regarding my Point struct already mentioned here: template class: ctor against function -> new
Regarding the code below, I'm trying to get the BOOKGUI class to access the
Regarding separations of concerns only, are there advantages of using ASP.NET MVC instead of
Regarding the following C++ program: class Base { }; class Child : public Base
Regarding class public class declaration, please look at these two pieces of code: public
Regarding the preventing of already in use errors i want to ask if the
Regarding the below code, how does the compiler choose which template function to call?
Regarding Django & Python: The Error: Exception Type: DatabaseError Exception Value: column objects_thing.name_id does
Regarding the backwards-incompatible change of Watir 0.5.x Finding elements by :class now matches partial
Regarding the following code - I'm trying to get it throw and exception if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.