From 60103f7ad657e88b1fb7db89183040b673b5e5a7 Mon Sep 17 00:00:00 2001
From: John Preston <johnprestonmail@gmail.com>
Date: Wed, 14 Nov 2018 17:20:24 +0400
Subject: [PATCH] Use upstream range-v3 on MSVC.

The build works using MSVS 15.9 and latest range-v3 code.
---
 Telegram/SourceFiles/base/base_pch.h           |  3 ---
 Telegram/SourceFiles/export/export_pch.h       |  3 ---
 .../platform/win/windows_range_v3_helpers.h    | 18 ------------------
 Telegram/SourceFiles/stdafx.h                  |  3 ---
 Telegram/SourceFiles/storage/storage_pch.h     |  3 ---
 Telegram/gyp/telegram_sources.txt              |  1 -
 docs/building-msvc.md                          |  2 +-
 7 files changed, 1 insertion(+), 32 deletions(-)
 delete mode 100644 Telegram/SourceFiles/platform/win/windows_range_v3_helpers.h

diff --git a/Telegram/SourceFiles/base/base_pch.h b/Telegram/SourceFiles/base/base_pch.h
index 91cfe95ee..933cf5b25 100644
--- a/Telegram/SourceFiles/base/base_pch.h
+++ b/Telegram/SourceFiles/base/base_pch.h
@@ -22,9 +22,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 #include <set>
 
 #include <range/v3/all.hpp>
-#ifdef Q_OS_WIN
-#include "platform/win/windows_range_v3_helpers.h"
-#endif // Q_OS_WIN
 
 #include "base/flat_map.h"
 #include "base/flat_set.h"
diff --git a/Telegram/SourceFiles/export/export_pch.h b/Telegram/SourceFiles/export/export_pch.h
index 8c420524a..049a7d3e1 100644
--- a/Telegram/SourceFiles/export/export_pch.h
+++ b/Telegram/SourceFiles/export/export_pch.h
@@ -27,9 +27,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 #include <atomic>
 
 #include <range/v3/all.hpp>
-#ifdef Q_OS_WIN
-#include "platform/win/windows_range_v3_helpers.h"
-#endif // Q_OS_WIN
 
 #include "base/flat_map.h"
 #include "base/flat_set.h"
diff --git a/Telegram/SourceFiles/platform/win/windows_range_v3_helpers.h b/Telegram/SourceFiles/platform/win/windows_range_v3_helpers.h
deleted file mode 100644
index 914a1bb4a..000000000
--- a/Telegram/SourceFiles/platform/win/windows_range_v3_helpers.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-This file is part of Telegram Desktop,
-the official desktop application for the Telegram messaging service.
-
-For license and copyright information please follow this link:
-https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
-*/
-#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 79b0229fa..c5735ee16 100644
--- a/Telegram/SourceFiles/stdafx.h
+++ b/Telegram/SourceFiles/stdafx.h
@@ -54,9 +54,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 #include <optional>
 
 #include <range/v3/all.hpp>
-#ifdef Q_OS_WIN
-#include "platform/win/windows_range_v3_helpers.h"
-#endif // Q_OS_WIN
 
 // Ensures/Expects.
 #include <gsl/gsl_assert>
diff --git a/Telegram/SourceFiles/storage/storage_pch.h b/Telegram/SourceFiles/storage/storage_pch.h
index 64d635c3d..986858f6a 100644
--- a/Telegram/SourceFiles/storage/storage_pch.h
+++ b/Telegram/SourceFiles/storage/storage_pch.h
@@ -21,9 +21,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 #include <set>
 
 #include <range/v3/all.hpp>
-#ifdef Q_OS_WIN
-#include "platform/win/windows_range_v3_helpers.h"
-#endif // Q_OS_WIN
 
 #include "base/flat_map.h"
 #include "base/flat_set.h"
diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt
index e311af8fe..096b1f14c 100644
--- a/Telegram/gyp/telegram_sources.txt
+++ b/Telegram/gyp/telegram_sources.txt
@@ -515,7 +515,6 @@
 <(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_launcher.h
diff --git a/docs/building-msvc.md b/docs/building-msvc.md
index 128a9ad43..8f1efff4b 100644
--- a/docs/building-msvc.md
+++ b/docs/building-msvc.md
@@ -55,7 +55,7 @@ Open **x86 Native Tools Command Prompt for VS 2017.bat**, go to ***BuildPath***
     mkdir Libraries
     cd Libraries
 
-    git clone https://github.com/Microsoft/Range-V3-VS2015 range-v3
+    git clone https://github.com/ericniebler/range-v3 range-v3
 
     git clone https://github.com/telegramdesktop/lzma.git
     cd lzma\C\Util\LzmaLib