diff --git a/src/analyse/analyse.h b/src/analyse/analyse.h index 784ce44..0100d9f 100644 --- a/src/analyse/analyse.h +++ b/src/analyse/analyse.h @@ -11,6 +11,18 @@ // TODO: try double or 4-times size const uint32_t ANY_MAP_RESERVE = 65536; +#include + +class Test { +public: + Test() { + std::cout << "Test init" << std::endl; + } + ~Test() { + std::cout << "Test destroy" << std::endl; + } +}; + class Analyse { public: typedef std::function match_t; @@ -45,11 +57,15 @@ private: public: struct backtrack_t { +// backtrack_t(int i); + uint64_t code; uint32_t layer_num; std::list last; std::list next; + Test test; + // bool operator==(const backtrack_t &b) const { // return b.code == code; // } diff --git a/src/analyse/backtrack.cc b/src/analyse/backtrack.cc index 3008add..9e2621e 100644 --- a/src/analyse/backtrack.cc +++ b/src/analyse/backtrack.cc @@ -11,7 +11,7 @@ namespace std { template<> struct hash { std::size_t operator()(const Analyse::backtrack_t &b) const { -// std::cout << "get hash: " << b.code << std::endl; + std::cout << "get hash: " << b.code << std::endl; return std::hash()(b.code); } }; @@ -19,9 +19,14 @@ namespace std { template<> struct equal_to { bool operator()(const Analyse::backtrack_t &b1, const Analyse::backtrack_t &b2) const { -// std::cout << "get eq: " << b1.code << " ? " << b2.code << std::endl; + std::cout << "get eq: " << b1.code << " ? " << b2.code << std::endl; return b1.code == b2.code; } + +// bool operator()(const Analyse::backtrack_t &b, uint64_t c) const { +// std::cout << "eq: " << b.code << " ? " << c << std::endl; +// return b.code == c; +// } }; } @@ -41,6 +46,7 @@ void Analyse::backtrack_demo(uint64_t code) { .layer_num = 1, .last = std::list{}, .next = std::list{}, + }); } @@ -53,4 +59,9 @@ void Analyse::backtrack_demo(uint64_t code) { std::cout << "bucket " << i << " -> " << test.bucket_size(i) << std::endl; } + uint64_t dat = 4000; + auto ret = test.find((backtrack_t&)(dat)); + + std::cout << "insert demo ending" << std::endl; + }