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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:02:23+00:00 2026-05-18T07:02:23+00:00

#include <iostream> #include <math.h> using namespace std; template<template<short,short,short,int> class Derived> struct AllocFactor_Core { private:

  • 0
            #include <iostream>
            #include <math.h>
            using namespace std;

            template<template<short,short,short,int> class Derived>
                struct AllocFactor_Core
                {

                private:
                    static long double factor_;
                    static long double calcFactor_(const short mantissa, const short exponent,const short base)
                    {

                        return mantissa * ::pow(static_cast<long double>(base),exponent);
                    }
                public:
                    static const long double getFactor()
                    {
                        return factor_;
                    }

                    void setFactor(const short mantissa,const short exponent,const short base)
                    {
                        factor_ = calcFactor_(mantissa,exponent,base);
                    }
                    void setFactor(const long double factor)
                    {
                        factor_ = factor;
                    }

                };

                template<short Mantissa, short Exponent, short Base = 10, int Tag = 0>
                struct AllocFactorScientific : private AllocFactor_Core<AllocFactorScientific>
                {
                    static short base_;
                    using AllocFactor_Core<AllocFactorScientific<Mantissa,Exponent,Base,Tag>>::getFactor;
        //I'm getting an error here saying: error: type/value mismatch at argument 1 in template 
      //parameter list for 'template<template<short int <anonymous>, short int <anonymous>, short int   
   // <anonymous>, int <anonymous> > class Derived> struct AllocFactor_Core'|  
                    };
                template<short Mantissa, short Exponent, short Base, int Tag>
                short AllocFactorScientific<Mantissa, Exponent, Base,Tag>::base_ = Base;  

Please see comment in code (3 lines above). Basically what happens is that if I have the AllocFactor_Core class as a regular non-template class and when with using directive I just provide name of this class followed by :: and fnc name it works, but as soon as I declare AllocFactor_Core as a template and I try to provide params for it I’m getting beforementioned error.

  • 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-05-18T07:02:23+00:00Added an answer on May 18, 2026 at 7:02 am

    Your base class expects a template template parameter, but you are passing it a concrete class. Use e.g. the following instead:

    using AllocFactor_Core< ::AllocFactorScientific >::getFactor;
    

    Note that the following doesn’t work either because of the class name injection:

    using AllocFactor_Core< AllocFactorScientific >::getFactor;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

code: #include<iostream> using namespace std; template<class T, int N> class point { T coordinate[N];
#include<iostream> using namespace std; class A { int a; int b; public: void eat()
#include <iostream> #include <queue> using namespace std; struct Call { Call( int callNum, long
#include <iostream> using namespace std; int main() { double u = 0; double w
#include <iostream> using namespace std; class Base { public: Base(){cout <<Base<<endl;} virtual ~Base(){cout<<~Base<<endl;} virtual
#include <iostream> #include <vector> using namespace std; int main() { vector< vector<int> > dp(50000,
I have this code #include <iostream> using namespace std; int main(int argc,char **argv) {
#include <iostream> #include <string> #include <regex> #include <ios> #include <locale> using namespace std; int
#include <iostream> using namespace std; class Array { friend ostream &operator<<( ostream &, const
#include <iostream> using namespace std; template<typename T> void test() { cout << 1; }

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.