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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:11:44+00:00 2026-05-24T13:11:44+00:00

Im reading c++ primer plus and having some issues understanding how implicit instantiation works.

  • 0

Im reading c++ primer plus and having some issues understanding how implicit instantiation works. I havent learned classes yet, so I am just dealing with functions. I think I understand the basics of implicit instantiation (function templates) but I just dont understand explicit instantiation. I have below a function that uses a template, can someone show me how a function like this would be written if it used a explicit instantiation. You can change the way it works, but just keep it simple. I would really be appreciative. This will help me understand the syntax, and how it is used.

  2 #include <iostream>
  3 
  4 template <typename T>
  5 void show(T,T);
  6 
  7 
  8 int main()
  9 {
 10   int a = 10, b = 12;
 11   char c = 'x', d = 'y';
 12   
 13   show(a,b);
 14   show(c,d);
 15   
 16   return 0;
 17 } 
 18 
 19 template <typename T>
 20 void show(T a, T b )
 21 { 
 22   std::cout << "I used the int version " << a << " " << b << "\n";
 23 }
  • 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-24T13:11:45+00:00Added an answer on May 24, 2026 at 1:11 pm

    Just do a Show<int>(c, d) Notice that I’ve explicitly instantiated the int version, but passed the char parameters. That’s (a rather simple take on) explicit instantiation, but you might be actually referring to explicit specialization.

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

Sidebar

Related Questions

I am half way reading the OWL2 primer and is having problem understanding the
Possible Duplicate: Good Primer for Python Slice Notation I've been reading over some sample
While reading C++ Primer Plus 5th edition, I saw this piece of code: cin.get(ch);
Probably an extremely simple answer to this extremely simple question: I'm reading C Primer
I'm reading through an example in primer and something which it talks about is
I pulled up the NWmatcher source code for some light morning reading and noticed
I was reading through the c++ Primer and this code snippet came up and
I am reading the book C++ Primer and at the file input output chapter
I'm trying to self-study C using C Primer Plus from Stephen Prata and one
What is the difference between EquivalentClass and SubClass of? While reading through OWL primer,

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.