【学习笔记】各种错误记录

    科技2022-08-04  135

    stack_overflow

    递归次数过多爆栈辣

    heap-buffer-overflow

    内存是否存在非法访问

    默认构造函数

    call to implicitly-deleted default constructor of ‘unordered_set<vector >’

    unordered_set基于hashtable实现,而我所使用的key_value是vector<int>没有hash键值

    这篇博客和这篇博客展示了如何自己写hash函数重载

    struct hashfunc { template<typename T, typename U> size_t operator() (const pair<T, U> &i) const { return hash<T>()(i.first) ^ hash<U>()(i.second); } }; unordered_map< pair<int, int>, int , hashfunc > mp; struct MyKeyHashHasher { size_t operator()(const MyKey &k) const noexcept { return std::hash<int>{}(k.key); } };
    Processed: 0.012, SQL: 8