1
This commit is contained in:
parent
6a750f136e
commit
90512323d4
@ -81,31 +81,31 @@ namespace a8
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
a8::CommonRank<T>& ForceCreateCommonRankList(std::map<long long, a8::CommonRank<T>>& rank_list,
|
a8::CommonRank<T>* ForceCreateCommonRankList(std::map<long long, a8::CommonRank<T>>& rank_list,
|
||||||
long long key,
|
long long key,
|
||||||
std::function<bool (const T*, const T*)> cmp_func,
|
std::function<bool (const T*, const T*)> cmp_func,
|
||||||
size_t max_num)
|
size_t max_num)
|
||||||
{
|
{
|
||||||
auto itr = rank_list.find(key);
|
auto itr = rank_list.find(key);
|
||||||
if (itr != rank_list.end()) {
|
if (itr != rank_list.end()) {
|
||||||
return itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
rank_list[key] = a8::CommonRank<T>(cmp_func, max_num);
|
rank_list[key] = a8::CommonRank<T>(cmp_func, max_num);
|
||||||
return rank_list[key];
|
return &rank_list[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static a8::CommonRank<T>& ForceCreateCommonRankList(std::map<std::string, a8::CommonRank<T>>& rank_list,
|
static a8::CommonRank<T>* ForceCreateCommonRankList(std::map<std::string, a8::CommonRank<T>>& rank_list,
|
||||||
const std::string& key,
|
const std::string& key,
|
||||||
std::function<bool (const T*, const T*)> cmp_func,
|
std::function<bool (const T*, const T*)> cmp_func,
|
||||||
size_t max_num)
|
size_t max_num)
|
||||||
{
|
{
|
||||||
auto itr = rank_list.find(key);
|
auto itr = rank_list.find(key);
|
||||||
if (itr != rank_list.end()) {
|
if (itr != rank_list.end()) {
|
||||||
return itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
rank_list[key] = a8::CommonRank<T>(cmp_func, max_num);
|
rank_list[key] = a8::CommonRank<T>(cmp_func, max_num);
|
||||||
return rank_list[key];
|
return &rank_list[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user