Changeset 601

Show
Ignore:
Timestamp:
07/22/08 05:41:21 (4 months ago)
Author:
weyrick
Message:

might as well support bstring keys

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/rphp/runtime/include/pHash.h

    r600 r601  
    3434// custom key type 
    3535namespace rphp { 
    36     typedef boost::variant< pInt, pUString > hKeyVar; 
    37     typedef enum { hKeyInt, hKeyStr  } hKeyType; 
     36    typedef boost::variant< pInt, pBString, pUString > hKeyVar; 
     37    typedef enum { hKeyInt, hKeyBStr, hKeyUStr  } hKeyType; 
    3838} 
    3939 
     
    5353            return static_cast<std::size_t>(k); 
    5454        } 
     55         
     56        std::size_t operator()(const pBString &k) const { 
     57            return boost::hash_value(k); 
     58        } 
    5559 
    5660        std::size_t operator()(const pUString &k) const { 
     
    6872            return hKeyInt; 
    6973        } 
     74         
     75        hKeyType operator()(const pBString &k) const { 
     76            return hKeyBStr; 
     77        } 
    7078 
    7179        hKeyType operator()(const pUString &k) const { 
    72             return hKeyStr; 
     80            return hKeyUStr; 
    7381        } 
    7482 
     
    8290 
    8391        h_container(const pUString k, pVarP d) : pData(d), key(k) { } 
     92         
     93        h_container(const pBString k, pVarP d) : pData(d), key(k) { } 
    8494 
    8595        h_container(const pInt k, pVarP d) : pData(d), key(k) { }