Changeset 2104 for trunk


Ignore:
Timestamp:
Nov 21, 2012, 1:57:28 PM (7 years ago)
Author:
sam
Message:

core: allow hashing of String objects.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/hash.cpp

    r2097 r2104  
    123123}
    124124
    125 uint32_t Hash<char const *>::operator ()(char const *s)
     125static uint32_t HashCharString(char const *s)
    126126{
    127127    uint32_t ret = 0xffffffffu, ch;
     
    133133}
    134134
     135uint32_t Hash<char const *>::operator ()(char const *s)
     136{
     137    return HashCharString(s);
     138}
     139
     140uint32_t Hash<String>::operator ()(String const &s)
     141{
     142    return HashCharString(&s[0]);
     143}
     144
    135145} /* namespace lol */
    136146
  • trunk/src/lol/core/hash.h

    r2097 r2104  
    3838};
    3939
     40template<> class Hash<String>
     41{
     42public:
     43    uint32_t operator()(String const &s);
     44};
     45
    4046} /* namespace lol */
    4147
Note: See TracChangeset for help on using the changeset viewer.