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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:28:43+00:00 2026-05-13T08:28:43+00:00

I have a simple function template: #include <iostream> using namespace std; template <class T>

  • 0

I have a simple function template:

#include <iostream>
using namespace std;

template <class T>
T GetMax (T a, T b) {
  T result;
  result = (a > b) ? a : b;
  return (result);
}

int main () {
  cout << GetMax<int>(5, 6) << endl;
  cout << GetMax<long>(10, 5) << endl;
  return 0;
}

The above example will generate 2 function template instantiations, one for int and another for long. Is there any g++ option to view the function template instantiations?

  • 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-13T08:28:43+00:00Added an answer on May 13, 2026 at 8:28 am

    You can use the nm program (part of binutils) to see the list of symbols used by your program. For example:

    $ g++ test.cc -o test
    $ nm test | grep GetMax
    00002ef0 T __Z6GetMaxIiET_S0_S0_
    00002f5c T __Z6GetMaxIiET_S0_S0_.eh
    00002f17 T __Z6GetMaxIlET_S0_S0_
    00002f80 T __Z6GetMaxIlET_S0_S0_.eh
    

    I don’t know why each one has two copies, one with a .eh suffix, but otherwise you can tell that this particular function was instantiated twice. If you version of nm supports the -C/--demangle flag, you can use that to get readable names:

    $ nm --demangle test | grep GetMax
    00002ef0 T int GetMax<int>(int, int)
    00002f5c T _Z6GetMaxIiET_S0_S0_.eh
    00002f17 T long GetMax<long>(long, long)
    00002f80 T _Z6GetMaxIlET_S0_S0_.eh
    

    If that option isn’t supported, you can use c++filt to demangle them:

    $ nm test | grep GetMax | c++filt
    00002ef0 T int GetMax<int>(int, int)
    00002f5c T __Z6GetMaxIiET_S0_S0_.eh
    00002f17 T long GetMax<long>(long, long)
    00002f80 T __Z6GetMaxIlET_S0_S0_.eh
    

    So, you can see that GetMax was instantiated with int and long respectively.

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

Sidebar

Ask A Question

Stats

  • Questions 292k
  • Answers 292k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Something along the lines of the following will allow you… May 13, 2026 at 6:17 pm
  • Editorial Team
    Editorial Team added an answer No, there is no functionality like that but it usually… May 13, 2026 at 6:17 pm
  • Editorial Team
    Editorial Team added an answer iPhone OS had created another folder "/private/var/mobile/Media/DCIM/101APPLE/" different from the… May 13, 2026 at 6:17 pm

Related Questions

Edit: I've edited the sample to better resemble the problem I have, now the
Okay, sample code first; this is my attempt at communicating what it is that
I have a simple C++ with Boost like this: #include <boost/algorithm/string.hpp> int main() {
Alright, I'm confused as hell. I have an object that I store in a
I have couple questions regarding some C++ rules. Why am I able to call

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.