Commit 6d299ca1 authored by Eric Niebler's avatar Eric Niebler Committed by Facebook GitHub Bot

Fix the Folly OSS build by guarding the include of range-v3 header

Summary: Folly OSS does not list range-v3 as a dependency. As a result, test/RangeTest.cpp fails to compile because it tries to include a range-v3 header. This change gates the inclusion of the header with `__has_include`, making the dependency optional.

Reviewed By: yfeldblum

Differential Revision: D20839733

fbshipit-source-id: 2d5e9c17427a0913f40f1ee80e868e27080a68f0
parent 96f9e38d
......@@ -37,8 +37,15 @@
#include <folly/portability/GTest.h>
#include <folly/portability/SysMman.h>
#if __has_include(<range/v3/range/concepts.hpp>)
#include <range/v3/range/concepts.hpp>
// Check conformance with the C++20 range concepts as specified
// by the range-v3 library.
CPP_assert(ranges::range<folly::StringPiece>);
CPP_assert(ranges::view_<folly::StringPiece>);
#endif
using namespace folly;
using namespace folly::detail;
using namespace std;
......@@ -47,11 +54,6 @@ static_assert(std::is_literal_type<StringPiece>::value, "");
BOOST_CONCEPT_ASSERT((boost::RandomAccessRangeConcept<StringPiece>));
// Check conformance with the C++20 range concepts as specified
// by the range-v3 library.
CPP_assert(ranges::range<StringPiece>);
CPP_assert(ranges::view_<StringPiece>);
TEST(StringPiece, All) {
const char* foo = "foo";
const char* foo2 = "foo";
......
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