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 8190565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:42:01+00:00 2026-06-07T03:42:01+00:00

I am thinking about using curiously recurring template pattern for my application. However, I

  • 0

I am thinking about using curiously recurring template pattern for my application. However, I would like the classes to operate on the user defined types. I would like to understand if it is possible to create a structure similar to the one shown below:

template <class T_leaftype>
class BaseTrajectoryPoint {
};


template <class MyType>
class MyTrajectoryPoint: public BaseTrajectoryPoint<MyTrajectoryPoint> {
    private:    
        MyType A;
};

The code above fails to compile with the following error:

type/value mismatch at argument 1 in template parameter list for ‘template class BaseTrajectoryPoint’

Are there any alternative ways of approaching the problem? I would like to use static polymorphism, but I would prefer to define all possible methods in the base class.

  • 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-07T03:42:02+00:00Added an answer on June 7, 2026 at 3:42 am
    template <class T_leaftype>
    class BaseTrajectoryPoint {
    };
    
    
    template <class MyType>
    class MyTrajectoryPoint: public BaseTrajectoryPoint<MyTrajectoryPoint<MyType> > {
        private:    
            MyType A;
    };
    

    MyTrajectoryPoint isn’t a type, it’s template; when you pass it as template parameter, it’s seen as template<typename> class T>, not template<class T> – and the latter is what your base class is expecting. But MyTrajectoryPoint<MyType> names a type, so you can use it as template parameter of your base class.

    Of course, you can change declaration of BaseTrajectoryPoint to template<template<class> class T_leaftype>, but then you would have to use class template as template parameter, never a complete type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm thinking about using the java application object to implement a simple cache, to
I'm thinking about using a ViewFlipper for an Wizard like Activity. But I see
Since Intellij does not yet support the Play-Scala-Template-Engine I was thinking about using plain
For my web application, I am thinking about using the Spring framework. Initially, I
I need to create a user configurable web spider/crawler, and I'm thinking about using
I'm thinking about using something like: <script src=http://www.example.com/?key={param:value}> As you can see in the
I was thinking about using Singleton pattern in my project, so I searched StackOverflow
I'm thinking about using Entity Framework in an ASP.NET application, using an Oracle database.
I'm thinking about using PhysicsFS in my game engine project, but I'd like to
I am thinking about using web services (SOAP) for the web based Timesheet application.

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.