Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String uri = "Some URI"
- public int hashCode() {
- return uri.hashCode();
- }
- #include <boost/functional/hash.hpp>
- int hashCode()
- {
- boost::hash<std::string> string_hash;
- return string_hash("Hash me");
- }
- std::hash<std::string>()("foo");
- public int hashCode()
- {
- int h = hash;
- if (h == 0 && count > 0)
- {
- int off = offset;
- char val[] = value;
- int len = count;
- for (int i = 0; i < len; i++)
- {
- h = 31*h + val[off++];
- }
- hash = h;
- }
- return h;
- }
- boost::hash<std::string> string_hash;
- std::size_t h = string_hash("Hash me");
- int hashCode(QString text){
- int hash = 0, strlen = text.length(), i;
- QChar character;
- if (strlen == 0)
- return hash;
- for (i = 0; i < strlen; i++) {
- character = text.at(i);
- hash = (31 * hash) + (character.toAscii());
- }
- return hash;
- }
- int HashCode (const std::string &str) {
- int h = 0;
- for (size_t i = 0; i < str.size(); ++i)
- h = h * 31 + static_cast<int>(str[i]);
- return h;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement