From 837dac50fa494b5fbb815234a878c1c5ab6ffaf1 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 25 Nov 2017 01:05:14 +0400 Subject: [PATCH] Fix build for the original range-v3. --- Telegram/SourceFiles/boxes/confirm_box.cpp | 2 +- .../platform/win/windows_range_v3_helpers.h | 31 +++++++++++++++++++ Telegram/SourceFiles/stdafx.h | 4 +++ Telegram/gyp/telegram_sources.txt | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 Telegram/SourceFiles/platform/win/windows_range_v3_helpers.h diff --git a/Telegram/SourceFiles/boxes/confirm_box.cpp b/Telegram/SourceFiles/boxes/confirm_box.cpp index c762197f6..f068edd43 100644 --- a/Telegram/SourceFiles/boxes/confirm_box.cpp +++ b/Telegram/SourceFiles/boxes/confirm_box.cpp @@ -456,7 +456,7 @@ DeleteMessagesBox::DeleteMessagesBox( std::vector DeleteMessagesBox::CollectFrom( const SelectedItemSet &items) { - return ranges::make_range( + return ranges::make_iterator_range( items.begin(), items.end() ) | ranges::view::transform([](not_null item) { diff --git a/Telegram/SourceFiles/platform/win/windows_range_v3_helpers.h b/Telegram/SourceFiles/platform/win/windows_range_v3_helpers.h new file mode 100644 index 000000000..ce362d8d9 --- /dev/null +++ b/Telegram/SourceFiles/platform/win/windows_range_v3_helpers.h @@ -0,0 +1,31 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org +*/ +#pragma once + +namespace ranges { +inline namespace v3 { +namespace { + +constexpr auto &&make_iterator_range = make_range; + +} // namespace +} // inline namespace v3 +} // namespace ranges diff --git a/Telegram/SourceFiles/stdafx.h b/Telegram/SourceFiles/stdafx.h index b4a9e20b3..db9e8c25d 100644 --- a/Telegram/SourceFiles/stdafx.h +++ b/Telegram/SourceFiles/stdafx.h @@ -63,7 +63,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include #include #include + #include +#ifdef Q_OS_WIN +#include "platform/win/windows_range_v3_helpers.h" +#endif // Q_OS_WIN // Ensures/Expects. #include diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt index 3a071ddfb..eaad43edb 100644 --- a/Telegram/gyp/telegram_sources.txt +++ b/Telegram/gyp/telegram_sources.txt @@ -438,6 +438,7 @@ <(src_loc)/platform/win/windows_dlls.h <(src_loc)/platform/win/windows_event_filter.cpp <(src_loc)/platform/win/windows_event_filter.h +<(src_loc)/platform/win/windows_range_v3_helpers.h <(src_loc)/platform/platform_audio.h <(src_loc)/platform/platform_file_utilities.h <(src_loc)/platform/platform_main_window.h