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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:16:22+00:00 2026-06-18T02:16:22+00:00

So I have this problem. Basicly I have a templated interface: template <typename T,

  • 0

So I have this problem.

Basicly I have a templated interface:

template <typename T, typename U>
class                    Iinterface
{
 public:
 virtual ~Iinterface()
 // A pure methode for the example that gives me the problem
 virtual std::vector<T>        myMethod(T, U) = 0;
};

No problem for now.
So I declare a class that will inherit from this interface.

class                  firstclass : public Iinterface<std::string, int>
{
  // content doesnt matter. The problem is in second class inheritance.
  // here I just put the class so we can see how I inherited in 1st class.
};

Now the myMethod decleration in the cpp file.

template <>
std::vector<std::string>        firstClass::iInterface<std::string, int>::myMethod(std::string a, int b)
 {
      // methods code
 }

So far I have no problem. It is in my second class where I declare the myMethod function and that the type T is the same as the return value that it gives me a compilation error.

class                           secondClass : public IInterface<std::vector<std::string>, int>
{
  // class content
};

For the moment it compiles but when I declare the myMethod like this :

template <>
std::vector<std::string>                     secondClass::Iinterface<std::vector<std::string> a, int n>
{
  // methodes code
}

Here I get an error fot the std::vector return value and the one in the methods argument.
I believe it is a template conflict but I really don’t see how to go around this.

First error:

28 :template-id ‘_out<>’ for ‘std::vector<std::basic_string<char> > Iio<std::vector<std::basic_string<char> >, int>::_out(std::vector<std::basic_string<char> >, int)’ does not match any template declaration

Second error:

28 note: saw 1 ‘template<>’, need 2 for specializing a member function template

I am still learning how to code in c++ and learn fast but once in a while I get stuck and need some help.
Is the way I am trying to do this wrong?
Do I need to declare a third typename to go around this conflict? (I was thinking it will give just an other conflict because the two typenmaes are of the same type).

I know what I am trying to do might not be the best way to do this but I am still learning.

I tryed to make example code as simple as possible to explain my problem if you need more details dont hesitate to ask.

All help will be very apriciated.
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-18T02:16:23+00:00Added an answer on June 18, 2026 at 2:16 am

    It seems that return value for the second class function overload should be:

    std::vector<std::vector<std::string> >
    

    What compiler are you using, gcc gave error at template specifications.

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

Sidebar

Related Questions

I'm having problem with my array basicly this is what i have: $test =
I have come across a problem, I need to basicly deserialize this: <?xml version=1.0
I have this problem: I want to generate a new source code file from
I have this problem: $id is id for each user $img = 'http://www.somesite.com/pictures/'; $no_img
I have this problem since I'm beginning in OOP programming I want to close
I have this problem when I run SAS 9.2 on the command line on
I have this problem, when I load my form, the validation messages appears in
I have this problem in my SlashDot Menu. I want to change the picture
I have this problem that I can ref a button for control it. I
I have this problem having to display my jasper report on my grails 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.