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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:23:37+00:00 2026-05-17T16:23:37+00:00

I have to work out a small framwork that is going to be used

  • 0

I have to work out a small framwork that is going to be used by several of our applications. On top of this, the framework is going to be used multiple times within the same application, but with a slightly different configuration. The ‘nature’ of the configuration is more complex than just having some configuration options and some setters. In practice, the application has to deliver its own data structures that will be incorporated in the framework, making it even more complex.

I can see the following 4 alternatives in writing the framework:

  • Put the common logic in a base class, and tell the application that it should inherit from this base class
  • Put the logic in a templated class, in which the application should pass its own class implementation
  • Describe the application’s specific configuration in a configuration file and generate C++ code during the build process
  • Provide macro’s that can be used to expand the ‘configuration’ to actual code

Which arguments should be taken into account when choosing a good alternative?

Are some of these alternatives better than other, and why?

Notice that in my case, performance is a top-priority.

  • 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-17T16:23:38+00:00Added an answer on May 17, 2026 at 4:23 pm

    I would avoid runtime polymophism if peak performance really is an issue not only because the vtable lookup for virtual function calls but because:

    • inlining virtual calls to allow efficient cross function boundary optimizations is sort of difficult to do (the same applies to generated code compiled to a shared library loaded at runtime (“plugin”) and statically linked modules compiled from generated code utilizing a compiler that doesn’t support link time optimizations).
    • polymorphic objects usually have to be heap allocated to avoid slicing, possibly creating additional runtime overhead

    Macros tend to be hard to debug, so unless you need their ability to do string concatenations, which is their distinctive advantage over templates in some cases, I would personally go for a template based solution using static polymorphism techniques like, as you indicated, the curiously recurring template pattern and/or, if applicable, template specializations to handle custom data structures.

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

Sidebar

Related Questions

I have been trying to use a formula that is used to work out
I have a problem that I can't figure out. I'm building a small framework
I'm trying to work this out. In my project, i have a file called
Say I have a third party Application that does background work, but prints out
For a long time i have tried to work out the best way to
I have to work on several VB6 legacy projects and despite some good VB6
I have to work on some code that's using generic lists to store a
Sometimes I have to work on code that moves the computer clock forward. In
I am writing controls that work nice with JavaScript, but they have to work
I have used Flex for about a year before deciding that I would rather

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.