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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:59:14+00:00 2026-05-18T08:59:14+00:00

In our project we have something like this: struct PointI { // methods for

  • 0

In our project we have something like this:

struct PointI
{
  // methods for getting, setting and calculating some point stuff
private:
  int x;
  int y;
};

struct PointD
{
  // methods for getting, setting and calculating some point stuff
private:
  double x;
  double y;
};

I proposed to change that into something like that:

template<typename T>
struct Point
{
  // methods for gettig, setting and calculating some point stuff
private:
  T x;
  T y;
};

typedef Point<int> PointI;
typedef Point<double> PointD;
typedef Point<float> PointF;

But that was refused and I was told: “There is one problem with this approach – C++ symbol mangling and exporting. Templates are so long when used in exported symbols (API that uses them) and there is no way how to export templates.”

Is that argument so strong to allow lot of code duplication?

  • 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-18T08:59:14+00:00Added an answer on May 18, 2026 at 8:59 am

    Your boss (or whatever) is probably right. If you write a library that should be usable from other languages than C++, it is generally a good idea to write the interface in C only.

    Of course, you can still internally use templates, just don’t expose them.

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

Sidebar

Related Questions

We have this constant discussion in our project as to the granularity of our
Our project is held in a SourceSafe database. We have an automated build, which
I have finally got the green light to use Memcached in our project (after
We are currently using unit tests to test our project. We have the majority
In our web application we have a directory which resides outside of the project.
I have been looking into IKVMing Apache's FOP project to use with our .NET
We have CC.NET setup on our ASP.NET app. When we build the project, the
I have a snippet to create a 'Like' button for our news site: <iframe
Most of our Eclipse projects have multiple source folders, for example: src/main/java src/test/java When
We have similar code to the following in one of our projects. Can anyone

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.