把你的 LPCSTR 换成 string 试试(相关的代码都得修改哦),貌似在map的重载里面没有LPCSTR 的比较算法吧

解决方案 »

  1.   

    pair<LPCSTR, CacheItem>是什么?
      

  2.   

    struct CacheItem
    {
    LPSTR url;
    time_t expire;
    DWORD size;
    LPSTR filename;
    BOOL finished; ~CacheItem();
    CacheItem() : url(NULL), filename(NULL), size(0), expire(0), finished(FALSE) {}
    CacheItem(const DWORD ip, const LPCSTR url);
    CacheItem(const CacheItem& ori);
    };struct Pred
    {
        bool operator()(const LPCSTR& key1, const LPCSTR& key2) const
        {
            return strcmp(key1, key2) < 0;
        }
    };class PageCache
    {
    typedef std::map<LPCSTR, CacheItem, Pred> Cache_lv2;
    std::map<DWORD, Cache_lv2> lv1_index;public:
    enum BufStatus { OK, NOT_FINISH, NOT_EXIST, ERR };
    void removePage(DWORD ip, CacheItem* src);
    CacheItem* searchForPage(const DWORD ip, const LPCSTR url);
    static void retrievePage(CacheItem* key, char*& buf, DWORD& size, int clev = 9);
    static void destoryPageBuffer(char* buf);
    static BOOL resumePage(CacheItem* key, char* src, DWORD len, BOOL& cachable);
    static BufStatus checkPageIntegrity(CacheItem* key);
    static BOOL cancelPage(CacheItem* key);
    void clearCache();
    };是这样定义的