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 a problem that I can't figure out. I'm building a small framework
FINAL SOLUTION THAT I USED: This method did not work out very well for
I'm having an sql error that i can't work out. I have to update
This should be quite simple, but I can't work out the syntax. I have
I cannot work this out to save my life! So, I have a Codeigniter
I have the following code that I'm using in a small frame work I've
I have a generic Collection and am trying to work out how I can
I am trying to work out the best practice for my problem. I have
So I have a factory class and I'm trying to work out what the
I am trying to work out a complicated jQuery selection. I have an array,

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.