Attempt to fix build on Clang.
This commit is contained in:
parent
aab4ac8526
commit
56ad825693
|
@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <QtCore/QVector>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <range/v3/range/conversion.hpp>
|
||||
#include <gsl/gsl>
|
||||
|
||||
using mtpPrime = int32;
|
||||
|
@ -243,6 +244,18 @@ inline MTPvector<T> MTP_vector() {
|
|||
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 {
|
||||
|
||||
template <typename Accumulator>
|
||||
|
|
|
@ -295,11 +295,11 @@ MTPInputInvoice Form::inputInvoice() const {
|
|||
return MTP_inputInvoicePremiumGiftCode(
|
||||
MTP_inputStorePaymentPremiumGiftCode(
|
||||
MTP_flags(users->boostPeer ? Flag::f_boost_peer : Flag()),
|
||||
MTP_vector<MTPInputUser>(ranges::views::all(
|
||||
MTP_vector_from_range(ranges::views::all(
|
||||
users->users
|
||||
) | ranges::views::transform([](not_null<UserData*> user) {
|
||||
return MTPInputUser(user->inputUser);
|
||||
}) | ranges::to<QVector>),
|
||||
})),
|
||||
users->boostPeer ? users->boostPeer->input : MTPInputPeer(),
|
||||
MTP_string(giftCode.currency),
|
||||
MTP_long(giftCode.amount)),
|
||||
|
@ -321,16 +321,16 @@ MTPInputInvoice Form::inputInvoice() const {
|
|||
? Flag()
|
||||
: Flag::f_countries_iso2)),
|
||||
giveaway.boostPeer->input,
|
||||
MTP_vector<MTPInputPeer>(ranges::views::all(
|
||||
MTP_vector_from_range(ranges::views::all(
|
||||
giveaway.additionalChannels
|
||||
) | ranges::views::transform([](not_null<ChannelData*> c) {
|
||||
return MTPInputPeer(c->input);
|
||||
}) | ranges::to<QVector>()),
|
||||
MTP_vector<MTPstring>(ranges::views::all(
|
||||
})),
|
||||
MTP_vector_from_range(ranges::views::all(
|
||||
giveaway.countries
|
||||
) | ranges::views::transform([](QString value) {
|
||||
return MTP_string(value);
|
||||
}) | ranges::to<QVector>()),
|
||||
})),
|
||||
MTP_long(giftCode.randomId),
|
||||
MTP_int(giveaway.untilDate),
|
||||
MTP_string(giftCode.currency),
|
||||
|
|
Loading…
Reference in New Issue