how to get hash code of a string in c++

前端 未结 6 1724
庸人自扰
庸人自扰 2020-11-30 06:07

Following java code returns hash code of a string.

String uri = \"Some URI\"
public int hashCode() {
    return uri.hashCode();
}

I want t

6条回答
  •  庸人自扰
    2020-11-30 06:30

    Boost provides a hash function:

    boost hash

    #include 
    
    int hashCode()
    {
        boost::hash string_hash;
    
        return string_hash("Hash me");
    }
    

提交回复
热议问题