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

  • Home
  • SEARCH
  • 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 8471299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:45:32+00:00 2026-06-10T16:45:32+00:00

I have a variadic template member function defined as: template<typename … Params> VAlgorithm* CreateAlgorithm(const

  • 0

I have a variadic template member function defined as:

template<typename ... Params>
 VAlgorithm* CreateAlgorithm(const char *objectName, const char *className, Params ... par)

and I would like to take the address of the specialized version where Params contains no type (which I call the “empty” specialization), ie., of:

VAlgorithm* CreateAlgorithm(const char *objectName, const char *className)

I tried in several ways. The naive way:

&AlgorithmFactory::CreateAlgorithm<>

(since, for example, &AlgorithmFactory::CreateAlgorithm< int > works) and a more explicit way:

(VAlgorithm* (*)(const char*, const char*))AlgorithmFactory::CreateAlgorithm<>

With the explicit way, GCC 4.7.1 says:

error: insufficient contextual information to determine type

It seems that the “empty” specialization is not understood by the compiler, which interprets the missing template types as a lack of info and not as “no types” information. What is the correct way to do this? (Sorry for the potentially naive question but I’m fairly new to variadic templates and I found no documentation on this topic).
Thanks

  • 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-10T16:45:34+00:00Added an answer on June 10, 2026 at 4:45 pm

    Your code should work; see e.g. http://liveworkspace.org/code/6253cf45f416be60879b93aa74c24de8

    All the following syntaxes work for me:

    struct S {
      template<typename... Args> static int *foo(const char *, const char *, Args...);
    };
    
    int main() {
        (int *(*)(const char *, const char *))S::foo<>;
        (int *(*)(const char *, const char *))S::foo;
        (int *(&)(const char *, const char *))S::foo<>;
        (int *(&)(const char *, const char *))S::foo;
        int *(&f)(const char *, const char *) = S::foo<>;
        int *(&g)(const char *, const char *) = S::foo;
        int *(*h)(const char *, const char *) = S::foo<>;
        int *(*i)(const char *, const char *) = S::foo;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a variadic template function: template<typename T, typename ArgType> vector<T> createVector(const int count,
I have a template class with a variadic template member function that I am
Suppose I have a variadic template function like template<typename... Args> unsigned length(Args... args); How
I have a variadic function: LogWrite(FILE * fp, int level, const char * filename,
C++0x thread library or Boost.thread define a non-member variadic template function that locks all
I have a variadic template function which calls itself to determine the largest number
I have a variadic function which takes a float parameter. Why doesn't it work?
I'm writing a 64bit operating system using g++, and I have a variadic function
I have a function that takes variadic arguments, that I obtain from func_get_args() .
Is it possible to have multiple specializations of a variadic template where one of

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.