Thread: std::collate::hash historical question

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937

    std::collate::hash historical question

    I'm working with some C++14 code. A library we're using has its own partial port of C++17's std::string_view, but without a corresponding specialization of std::hash.

    I assumed that the standard contained no hash function that I could use, aside from std::hash<std::string>, but it turns out I'm wrong.

    There is a hash function buried in iostream's locales library: std::collate<CharT>::hash, std::collate<CharT>::do_hash - cppreference.com

    The cppreference page mentions its use by std::regex, so I was even more surprised to find that std::collate::hash is defined in C++98, which predates std::hash and std::regex.

    My question, for the language lawyers among you, is why was std::collate::hash included in the C++98 standard?
    Last edited by CodeMonkey; 12-27-2021 at 04:57 PM. Reason: "facets" -> "locales"
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What sort of code would historical figures write?
    By Alpo in forum General Discussions
    Replies: 10
    Last Post: 06-02-2014, 10:26 AM
  2. Hash Table resizing question
    By gibson221 in forum C Programming
    Replies: 1
    Last Post: 10-22-2012, 02:30 PM
  3. Question about Hash (once more)
    By audinue in forum Tech Board
    Replies: 6
    Last Post: 01-13-2009, 04:58 AM
  4. quick hash table question
    By Brian in forum C Programming
    Replies: 7
    Last Post: 07-30-2005, 07:22 PM
  5. Hash Function question
    By IfYouSaySo in forum C++ Programming
    Replies: 2
    Last Post: 03-30-2005, 12:32 AM

Tags for this Thread