mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Attempt to fix build on Clang.
This commit is contained in:
parent
aab4ac8526
commit
56ad825693
2 changed files with 19 additions and 6 deletions
|
@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include <QtCore/QVector>
|
#include <QtCore/QVector>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtCore/QByteArray>
|
#include <QtCore/QByteArray>
|
||||||
|
#include <range/v3/range/conversion.hpp>
|
||||||
#include <gsl/gsl>
|
#include <gsl/gsl>
|
||||||
|
|
||||||
using mtpPrime = int32;
|
using mtpPrime = int32;
|
||||||
|
@ -243,6 +244,18 @@ inline MTPvector<T> MTP_vector() {
|
||||||
return tl::make_vector<T>();
|
return tl::make_vector<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ranges::to<QVector> doesn't work with Qt 6 in Clang,
|
||||||
|
// because QVector is a type alias for QList there.
|
||||||
|
template <typename Rng>
|
||||||
|
inline auto MTP_vector_from_range(Rng &&range) {
|
||||||
|
using T = std::remove_cvref_t<decltype(*ranges::begin(range))>;
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0 ,0)
|
||||||
|
return MTP_vector<T>(std::forward<Rng>(range) | ranges::to<QList>());
|
||||||
|
#else // QT_VERSION >= 6.0
|
||||||
|
return MTP_vector<T>(std::forward<Rng>(range) | ranges::to<QVector>());
|
||||||
|
#endif // QT_VERSION < 6.0
|
||||||
|
}
|
||||||
|
|
||||||
namespace tl {
|
namespace tl {
|
||||||
|
|
||||||
template <typename Accumulator>
|
template <typename Accumulator>
|
||||||
|
|
|
@ -295,11 +295,11 @@ MTPInputInvoice Form::inputInvoice() const {
|
||||||
return MTP_inputInvoicePremiumGiftCode(
|
return MTP_inputInvoicePremiumGiftCode(
|
||||||
MTP_inputStorePaymentPremiumGiftCode(
|
MTP_inputStorePaymentPremiumGiftCode(
|
||||||
MTP_flags(users->boostPeer ? Flag::f_boost_peer : Flag()),
|
MTP_flags(users->boostPeer ? Flag::f_boost_peer : Flag()),
|
||||||
MTP_vector<MTPInputUser>(ranges::views::all(
|
MTP_vector_from_range(ranges::views::all(
|
||||||
users->users
|
users->users
|
||||||
) | ranges::views::transform([](not_null<UserData*> user) {
|
) | ranges::views::transform([](not_null<UserData*> user) {
|
||||||
return MTPInputUser(user->inputUser);
|
return MTPInputUser(user->inputUser);
|
||||||
}) | ranges::to<QVector>),
|
})),
|
||||||
users->boostPeer ? users->boostPeer->input : MTPInputPeer(),
|
users->boostPeer ? users->boostPeer->input : MTPInputPeer(),
|
||||||
MTP_string(giftCode.currency),
|
MTP_string(giftCode.currency),
|
||||||
MTP_long(giftCode.amount)),
|
MTP_long(giftCode.amount)),
|
||||||
|
@ -321,16 +321,16 @@ MTPInputInvoice Form::inputInvoice() const {
|
||||||
? Flag()
|
? Flag()
|
||||||
: Flag::f_countries_iso2)),
|
: Flag::f_countries_iso2)),
|
||||||
giveaway.boostPeer->input,
|
giveaway.boostPeer->input,
|
||||||
MTP_vector<MTPInputPeer>(ranges::views::all(
|
MTP_vector_from_range(ranges::views::all(
|
||||||
giveaway.additionalChannels
|
giveaway.additionalChannels
|
||||||
) | ranges::views::transform([](not_null<ChannelData*> c) {
|
) | ranges::views::transform([](not_null<ChannelData*> c) {
|
||||||
return MTPInputPeer(c->input);
|
return MTPInputPeer(c->input);
|
||||||
}) | ranges::to<QVector>()),
|
})),
|
||||||
MTP_vector<MTPstring>(ranges::views::all(
|
MTP_vector_from_range(ranges::views::all(
|
||||||
giveaway.countries
|
giveaway.countries
|
||||||
) | ranges::views::transform([](QString value) {
|
) | ranges::views::transform([](QString value) {
|
||||||
return MTP_string(value);
|
return MTP_string(value);
|
||||||
}) | ranges::to<QVector>()),
|
})),
|
||||||
MTP_long(giftCode.randomId),
|
MTP_long(giftCode.randomId),
|
||||||
MTP_int(giveaway.untilDate),
|
MTP_int(giveaway.untilDate),
|
||||||
MTP_string(giftCode.currency),
|
MTP_string(giftCode.currency),
|
||||||
|
|
Loading…
Add table
Reference in a new issue