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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:29:56+00:00 2026-06-16T17:29:56+00:00

Having done a brief search on the following error code from GCC, a number

  • 0

Having done a brief search on the following error code from GCC, a number of hits show questions asking for help for this problem, but nothing much concrete turns up:

error: explicit specialization of non-template 'std::hash'

It looks like std::hash is indeed a template, so the error is not clear on what the problem is. Sample code to generate the message is below. The GCC option, -std=c++0x, compiles the code just fine. The problem being that I have an older compiler that does not support C++11 on one machine, so some clarification on why this does not compile would be useful.

An alternative might be to use inheritance instead of specialization, and if that is the only solution, then that would be nice to know, also.

#include <functional>

struct test
{
    int n;
};

namespace std
{
    template<>
        struct hash<test>
        {
        };
}
  • 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-06-16T17:29:58+00:00Added an answer on June 16, 2026 at 5:29 pm

    The problem is that std::hash, and the unordered containers that use it, didn’t exist before C++11. If you need to use a compiler that only understands C++98, then you can’t use them.

    Similar containers are available in TR1 and Boost.

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

Sidebar

Related Questions

I'm looking for a very example file upload code snipplet/solution in Silverlight. Having done
Having done some programming in Groovy, I know you can write test code in
after having done some research, I seek you for some jquery math help. I
I know similar questions have been asked, e.g. here , but having done a
Im having problem in my UIscrollView ,this is what I have done: Whenever a
I know it can be done but am having issues getting it to work.
Simple question. Just wondering if this can be done without me having to enforce
Having trouble with each function... Will try to explain by example... In my code,
Having just added a new button in my web application, I get an error
I can't seem to find any examples of this having been done anywhere on

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.