Commit 941f7020 authored by Orvid King's avatar Orvid King Committed by Facebook GitHub Bot

Workaround MSVC 2019.8 bug with ranges::enable_view by including the definition

Summary: Owing to a set of bugs, it is not currently possible to actually declare ranges::enable_view without actually defining it, so we have to include the actual definition when we're in compilation units with it available. If the definition is not available, then the `const` form is sufficient to keep things compiling.

Reviewed By: yfeldblum

Differential Revision: D26337214

fbshipit-source-id: fb042b62967e3e6f536e8268e1b6dd6ccd20b810
parent a50bffda
......@@ -1526,12 +1526,21 @@ FOLLY_POP_WARNING
FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(folly::Range)
// Tell the range-v3 library that this type should satisfy
// the view concept (a lightweight, non-owning range).
// Unfortunately it is not possible to forward declare enable_view under
// MSVC 2019.8 due to compiler bugs, so we need to include the actual
// definition if available.
#if __has_include(<range/v3/range/concepts.hpp>) && defined(_MSC_VER) && _MSC_VER >= 1920
#include <range/v3/range/concepts.hpp> // @manual
#else
namespace ranges {
template <class T>
extern const bool enable_view;
} // namespace ranges
#endif
// Tell the range-v3 library that this type should satisfy
// the view concept (a lightweight, non-owning range).
namespace ranges {
template <class Iter>
FOLLY_INLINE_VARIABLE constexpr bool enable_view<::folly::Range<Iter>> = true;
} // namespace ranges
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment