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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:32:47+00:00 2026-05-23T10:32:47+00:00

In current g++, I typically include all my templated functions that take the template

  • 0

In current g++, I typically include all my templated functions that take the template parameter as an argument because they have to be compiled for each instance.

template<typename T>
class A {
public:
  void f() { ... }
};

So in a different source, I would write:

#include <A.hh>
A<int> a1;
a1.f();

A<double> a2;
a2.f();

Sometimes, when I’ve been desperate to not inline big methods, I’ve manually specified which classes will be used in the source file, but it’s really obnoxious:

template<typename T>
A::A() { ... }

template<typename T>
void A::f() { ... }

A<int>; // manually trigger code generation for int and double
A<double>; 

Obviously different IDEs and compilers have mechanisms to support this. Is there anything standard that has been mandated, and/or does g++ support anything like this?

  • 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-23T10:32:48+00:00Added an answer on May 23, 2026 at 10:32 am

    There’s nothing in the proposed C++0x standard. In fact, export template has been removed (few compilers implemented it anyway).

    As far as inlining is concerned, it’s a total non-issue. The compiler is smart enough not to inline functions which are too big, even if they’re marked inline and put into a header file.

    If you’re looking at increased compile times from header files grown bloated from templates, use precompiled headers. These aren’t standard, but almost all current compilers provide such a mechanism.

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

Sidebar

Related Questions

My current view is no, prefer Transact SQL stored procedures because they are a
I'd like some feedback on my current architecture. I have a Person resource that
For the current app I am writing I have elected to place all database
In my current project I have a few different interfaces that require me to
I have a table full of data that's typically pretty manageable, but on occasion
Current, I've got a stored procedure that has a main goal of doing a
The problem I'm running into the typical virtual-directory dilemma in that you have some
I typically refer to any assets on my site using absolute path so that
I have a pretty standard table set-up in a current application using the .NET
I have a byte array of 151 bytes which is typically a record, The

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.