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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:38:12+00:00 2026-05-27T15:38:12+00:00

Why doesn’t the compiler find a match for read1 ? I don’t see the

  • 0

Why doesn’t the compiler find a match for read1? I don’t see the difference between read1 and read2; is there a limitation for nested typedef templates like the one in the Foo class?

template<typename T>
class Handle{};

class Foo{
public:
    typedef Handle<Foo> Handle;
};


template<typename T>
void read1(typename T::Handle){}

template<typename T>
void read2(Handle<T>){}


int main(int argc, char** argv)
{
    Foo::Handle f1;    
    read1(f1);

    Foo::Handle f2;
    read2(f2);
}

G++ compiler output, (G++ 4.4.5)

g++ -c -I.  main1.cpp 
main1.cpp: In function ‘int main(int, char**)’:
main1.cpp:37: error: no matching function for call to ‘read1(Handle<Foo>&)’
  • 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-27T15:38:13+00:00Added an answer on May 27, 2026 at 3:38 pm
    Foo::Handle f1;    
    read1(f1);
    

    The type being passed to read1 is Handle<Foo>, not Foo.

    Templates are not inheritance. Handle<Foo> is a distinct class that is not a Foo, so there is no Handle<Foo>::Handle.

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

Sidebar

Related Questions

C# doesn't require you to specify a generic type parameter if the compiler can
There doesn't seem to be a dictionary.AddRange() method. Does anyone know a better way
There doesn't seem to be an accepted way of sending down a header parameter
Doesn't produce a app.config . In my team there is a guy who has
There doesn't seem to be a question for this, and it seems strange that
There doesn't seem to be a way to access stack traces for a released
There doesn't seem to be any tried and true set of best practices to
Why doesn't the file input element show up at all??? see code and screen
There doesn't seem to be any mention of this on facebook's API. I found
doesn't work.. can't find any solution to prevent submit page reload only if ajax

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.