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

The Archive Base Latest Questions

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

Can somebody please help me to port the following code to GCC ? I

  • 0

Can somebody please help me to port the following code to GCC? I have found a lot or related questions on this site, but I just can’t seem to apply suggested workarounds in my case…

typedef float MyData __attribute__ ((__vector_size__ (16)));

template <typename T> class Data_T
{
    public:
    template < typename U > static bool IsEqual (const T & a, const T & b)
    {
        return a == b;
    }

    //Fixed: template <> static bool IsEqual < MyData > ( const MyData & a, const MyData & b)
    static bool IsEqual ( const MyData & a, const MyData & b)
    {
        return true;
    }

    void TriggerProblem(const T & val)
    {
        if (!IsEqual(1.0f, val)) // Error: no matching function for call to 'Data_T<float>::IsEqual(float, const float&)'
        {

        }
    }
};

The code to trigger the problem:

Data_T<MyData> inst;
inst.TriggerProblem(1.0f);

I was getting an error error: explicit specialization in non-namespace scope ‘class Data_T’, which was caused by specialization function IsEqual(), but now encountered another type of error (no matching function for call to ‘Data_T::IsEqual(float, const float&)’), which seems to be caused by the __vector_size__ attribute, which I can’t remove. Please help…

  • 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-21T11:31:37+00:00Added an answer on May 21, 2026 at 11:31 am

    In this case overloading should suffice instead of specializing:

    template <typename T> class Data_T
    {
    public:
        template<typename U> static bool IsEqual(const U& a, const U& b)
        {
            return a == b;
        }
    
        static bool IsEqual(const MyData& a, const MyData& b)
        {
            return MyDataTypeIsEqual (a, b);
        }
    
        template<typename U> bool IsRangeEqual(const U& a, const U& b, const U& delta)
        {
            return  (a >= b) ? (a - b <= delta) : (b - a <= delta);
        }
    
        bool IsRangeEqual(const MyData & a, const MyData & b, const MyData & accuracy)
        {
            return MyDataTypeIsRangeEqual (a, b, accuracy);
        }
    };
    

    Edit regarding update:
    While for me the conversion from float to float __vector__ already fails, you seem to have a typo of:

    template<typename U> static bool IsEqual(const T& a, const T& b)
    

    vs.:

    template<typename U> static bool IsEqual(const U& a, const U& b)
    

    I fixed the above code accordingly.

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

Sidebar

Related Questions

Can somebody help me please, I have this code : $('childcat').setHTML('Loading...'); I would like
Can somebody please help me with this mail script. I'm simply trying to send
Can somebody please help me fix my code.? I can't see where I'm going
Can somebody please help me with this difficulty I am having? I would like
I'm trying to optimize this mysql query using EXPLAIN. Can somebody please help me
Can somebody please help me to write a DeepCopy routine for this matrix class
Can somebody please help me, I want to put the OK symbol throw HTML
Can somebody please tell me what is wrong with the following pom.xml? i'm getting
Can somebody please tell, what's the difference between the following two statements: TimeZone.getTimeZone(America/New_York) and
Can somebody please help me understand why my custom JComponent 'Bar', only displays when

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.