mirror of
https://github.com/vale981/tdesktop
synced 2025-03-05 09:41:41 -05:00
be compatible with range-v3 0.9.x/1.0 branch
This made 2 changes to the current code base to be compatible with higher versions of range-v3 library. 1. ranges::iterator_range was renamed to subrange, see https://github.com/ericniebler/range-v3/issues/766 2. PercentCounterItem need an operator== for ranges::sort for some reason
This commit is contained in:
parent
684cfa16b8
commit
9d850b71e7
6 changed files with 13 additions and 9 deletions
|
@ -449,7 +449,7 @@ std::vector<Result> EmojiKeywords::LangPack::query(
|
|||
}
|
||||
|
||||
const auto from = _data.emoji.lower_bound(normalized);
|
||||
auto &&chosen = ranges::make_iterator_range(
|
||||
auto &&chosen = ranges::subrange(
|
||||
from,
|
||||
end(_data.emoji)
|
||||
) | ranges::view::take_while([&](const auto &pair) {
|
||||
|
|
|
@ -764,7 +764,7 @@ void ApplyMegagroupAdmins(
|
|||
}
|
||||
|
||||
auto adding = base::flat_map<UserId, QString>();
|
||||
auto admins = ranges::make_iterator_range(
|
||||
auto admins = ranges::subrange(
|
||||
list.begin(), list.end()
|
||||
) | ranges::view::transform([](const MTPChannelParticipant &p) {
|
||||
const auto userId = p.match([](const auto &data) {
|
||||
|
|
|
@ -2444,7 +2444,7 @@ MessageIdsList HistoryInner::getSelectedItems() const {
|
|||
return {};
|
||||
}
|
||||
|
||||
auto result = make_iterator_range(
|
||||
auto result = ranges::subrange(
|
||||
_selected.begin(),
|
||||
_selected.end()
|
||||
) | view::filter([](const auto &selected) {
|
||||
|
|
|
@ -34,6 +34,10 @@ struct PercentCounterItem {
|
|||
int percent = 0;
|
||||
int remainder = 0;
|
||||
|
||||
inline bool operator==(const PercentCounterItem &o) const {
|
||||
return remainder == o.remainder && percent == o.percent;
|
||||
}
|
||||
|
||||
inline bool operator<(const PercentCounterItem &other) const {
|
||||
if (remainder > other.remainder) {
|
||||
return true;
|
||||
|
|
|
@ -291,7 +291,7 @@ auto Reader::Slice::prepareFill(int from, int till) -> PrepareFillResult {
|
|||
ranges::less(),
|
||||
&PartsMap::value_type::first);
|
||||
const auto haveTill = FindNotLoadedStart(
|
||||
ranges::make_iterator_range(start, finish),
|
||||
ranges::subrange(start, finish),
|
||||
fromOffset);
|
||||
if (haveTill < till) {
|
||||
result.offsetsFromLoader = offsetsFromLoader(
|
||||
|
@ -607,14 +607,14 @@ auto Reader::Slices::fill(int offset, bytes::span buffer) -> FillResult {
|
|||
markSliceUsed(fromSlice);
|
||||
CopyLoaded(
|
||||
buffer,
|
||||
ranges::make_iterator_range(first.start, first.finish),
|
||||
ranges::subrange(first.start, first.finish),
|
||||
firstFrom,
|
||||
firstTill);
|
||||
if (fromSlice + 1 < tillSlice) {
|
||||
markSliceUsed(fromSlice + 1);
|
||||
CopyLoaded(
|
||||
buffer.subspan(firstTill - firstFrom),
|
||||
ranges::make_iterator_range(second.start, second.finish),
|
||||
ranges::subrange(second.start, second.finish),
|
||||
secondFrom,
|
||||
secondTill);
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ auto Reader::Slices::fillFromHeader(int offset, bytes::span buffer)
|
|||
if (prepared.ready) {
|
||||
CopyLoaded(
|
||||
buffer,
|
||||
ranges::make_iterator_range(prepared.start, prepared.finish),
|
||||
ranges::subrange(prepared.start, prepared.finish),
|
||||
from,
|
||||
till);
|
||||
result.filled = true;
|
||||
|
|
|
@ -1141,7 +1141,7 @@ const QRegularExpression &RegExpWordSplit() {
|
|||
|
||||
[[nodiscard]] QString ExpandCustomLinks(const TextWithTags &text) {
|
||||
const auto entities = ConvertTextTagsToEntities(text.tags);
|
||||
auto &&urls = ranges::make_iterator_range(
|
||||
auto &&urls = ranges::subrange(
|
||||
entities.begin(),
|
||||
entities.end()
|
||||
) | ranges::view::filter([](const EntityInText &entity) {
|
||||
|
@ -2098,7 +2098,7 @@ EntityInText::EntityInText(
|
|||
int EntityInText::FirstMonospaceOffset(
|
||||
const EntitiesInText &entities,
|
||||
int textLength) {
|
||||
auto &&monospace = ranges::make_iterator_range(
|
||||
auto &&monospace = ranges::subrange(
|
||||
entities.begin(),
|
||||
entities.end()
|
||||
) | ranges::view::filter([](const EntityInText & entity) {
|
||||
|
|
Loading…
Add table
Reference in a new issue