|
@@ -6,6 +6,7 @@
|
|
|
#include<shared_mutex>
|
|
|
#include <variant>
|
|
|
#include<chrono>
|
|
|
+#include<iostream>
|
|
|
|
|
|
namespace nanxing_extend
|
|
|
{
|
|
@@ -294,21 +295,51 @@ namespace nanxing_extend
|
|
|
|
|
|
#ifdef SKIP_MAX_SIZE
|
|
|
[[nodicard]]
|
|
|
- auto change_size(int _max_size)->std::variant<Skip_result,V> noexcept
|
|
|
+ inline auto change_size(int _max_size)->std::variant<Skip_result,V> noexcept
|
|
|
+ {
|
|
|
+ std::variant<
|
|
|
+ if(_max_size>this->max_size)
|
|
|
{
|
|
|
- std::variant<
|
|
|
- if(_max_size>this->max_size)
|
|
|
- {
|
|
|
- this->max_size=_max_size;
|
|
|
- tmp=Skip_result::successufl;
|
|
|
- return tmp;
|
|
|
- }
|
|
|
- else
|
|
|
+ this->max_size=_max_size;
|
|
|
+ tmp=Skip_result::successufl;
|
|
|
+ return tmp;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tmp=Skip_result::too_samll;
|
|
|
+ return tmp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endif
|
|
|
+
|
|
|
+ #ifdef _NANXING_TEST_
|
|
|
+ inline void insert_check()
|
|
|
+ {
|
|
|
+ ptr tmp=head[0]->next_node[0];
|
|
|
+ K tmp_key;
|
|
|
+ if(tmp==nullptr)
|
|
|
+ {
|
|
|
+ std::cerr<<"the skiplist is empty"<<std::endl;
|
|
|
+ std::terminate();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tmp_key=head[0]->next_node[0]->key;
|
|
|
+ }
|
|
|
+ tmp=tmp->next_node[0];
|
|
|
+ while(tmp->next_node[0]!=nullptr)
|
|
|
+ {
|
|
|
+ if(tmp->next_node[0]->key<tmp_key)
|
|
|
{
|
|
|
- tmp=Skip_result::too_samll;
|
|
|
- return tmp;
|
|
|
+ std::cerr<<"THE skiplist insert error"<<std::endl;
|
|
|
+ std::terminate();
|
|
|
}
|
|
|
- }
|
|
|
+ tmp_key=tmp->key;
|
|
|
+ tmp=tmp->next_node[0];
|
|
|
+ }
|
|
|
+ std::cout<<"insert successful"<<std::endl;
|
|
|
+ }
|
|
|
+
|
|
|
#endif
|
|
|
|
|
|
|