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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:19:21+00:00 2026-05-28T11:19:21+00:00

I currently have to optimize code from another programmer. He left me with a

  • 0

I currently have to optimize code from another programmer. He left me with a lot of template classes and I would like to make use of functions from Intels IPP-Library to speed up computation. The problem is, that most of the time these functions require that you know what datatypes you are using. So I would like to rewrite the template so that in case the operation can be optimized it will use the specialized code. In case it can’t it should fall back to the original code.

The problem is that I would need to check if a certain datatype is being used and I don’t know how to do that.

An example. I would like to do something like this:

 template < class Elem > class Array1D
 {
    Array1D<Elem>& operator += (const Elem& a)
    {
    if (typeof(Elem) == uchar)
    {
       // use special IPP operation here
    }
    else
    {
           // fall back to default behaviour
    }
 }

Any ideas on how to do this? Preferrably without the help of other libraries.

Thank you

  • 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-28T11:19:22+00:00Added an answer on May 28, 2026 at 11:19 am

    Use specialization:

        template<> 
        class Array1D<uchar>
        {
            Array1D<uchar>& operator += (const uchar& a)
            {
            // special behaviour
            }
        };
    

    But if you dont want to rewrite all other functions in Array1D consider using overloading for operator+=.

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

Sidebar

Related Questions

We currently have code like this: Dim xDoc = XDocument.Load(myXMLFilePath) The only way we
I have been trying to optimize some code which handles raw pixel data. Currently
I have certain code that I want to optimize. It looks like this: function
I think I have something like programmer's OCD. I like my code to be
We currently have some code to extract digits from an int, but I need
I currently have a website that I am trying to optimize in terms of
I am currently trying to optimize some DSP related code with Shark and found
I have the following code on the client side for retrieving data from the
I am currently trying to optimize a function I have and am looking to
I'm trying to optimize my code to be called from both an UI-less commandline

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.