32 template <
typename InputTypeT>
34 :
_vec([](auto &&input) {
35 static_assert(!std::is_const<InputTypeT>::value,
"Input type cannot be const");
36 std::sort(std::begin(input), std::end(input),
LessComp());
37 return decltype(
_vec){
38 std::make_move_iterator(std::begin(input)),
39 std::make_move_iterator(std::end(input))};
40 }(std::move(range))) {}
43 const std::vector<mapped_type> &
GetAll()
const {
50 std::make_reverse_iterator(std::upper_bound(
_vec.begin(),
_vec.end(), k,
LessComp())),
56 auto low_bound = (std::lower_bound(
_vec.begin(),
_vec.end(), min_k,
LessComp()));
57 auto up_bound = (std::upper_bound(
_vec.begin(),
_vec.end(), max_k,
LessComp()));
63 auto low_bound = (std::lower_bound(
_vec.begin(),
_vec.end(), min_k,
LessComp()));
64 auto up_bound = (std::upper_bound(low_bound,
_vec.end(), max_k,
LessComp()));
65 return MakeListView(std::make_reverse_iterator(up_bound), std::make_reverse_iterator(low_bound));
90 template <
typename ValueT>
92 return value.GetDistance();
95 template <
typename ValueT>
97 return value->GetDistance();
100 template <
typename ValueT>
102 return value->GetDistance();
107 template <
typename LhsT,
typename RhsT>
110 const RhsT &b)
const {
这个类用于禁止拷贝构造函数和赋值操作,但允许移动构造函数和赋值操作
const std::vector< mapped_type > & GetAll() const
返回集合中的所有值。
std::vector< mapped_type > _vec
static key_type GetDistance(const ValueT &value)
static key_type GetDistance(const ValueT *value)
static key_type GetDistance(const key_type key)
auto GetSubsetInRange(const key_type min_k, const key_type max_k) const
返回键值在 [min_k, max_k] 范围内的元素列表。
RoadElementSet(std::vector< InputTypeT > &&range)
显式移动构造函数。
auto GetReverseSubsetInRange(const key_type min_k, const key_type max_k) const
返回键值在 [min_k, max_k] 范围内的元素的逆序列表。
static key_type GetDistance(const std::unique_ptr< ValueT > &value)
auto GetReverseSubset(const key_type k) const
返回键值小于等于 s 的元素的逆序列表。
static auto MakeListView(Iterator begin, Iterator end)
bool operator()(const LhsT &a, const RhsT &b) const