Skip to content

Commit

Permalink
Fix check for C++20 std::ranges
Browse files Browse the repository at this point in the history
Summary:
This PR tries to address an issue I've described in facebook/folly#2143

X-link: facebook/folly#2144

Reviewed By: Gownta

Differential Revision: D53830508

Pulled By: Orvid

fbshipit-source-id: a5fd37db447287f91761a9bfd0beab8feca50e77
  • Loading branch information
rnurgaliyev authored and facebook-github-bot committed Feb 16, 2024
1 parent a357c8e commit 7d60b12
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion third-party/folly/src/folly/container/range_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <folly/Traits.h>
#include <folly/Utility.h>

#if __has_include(<ranges>)
#if defined(__cpp_lib_ranges)
#include <ranges>
#endif

Expand Down
4 changes: 2 additions & 2 deletions third-party/folly/src/folly/container/tape.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
#include <type_traits>
#include <vector>

#if __has_include(<ranges>)
#if defined(__cpp_lib_ranges)
#include <ranges>
#endif

namespace folly {

#if __has_include(<ranges>)
#if defined(__cpp_lib_ranges)
#define FOLLY_TAPE_CONTAINER_REQUIRES std::ranges::random_access_range
#else
#define FOLLY_TAPE_CONTAINER_REQUIRES typename
Expand Down
4 changes: 2 additions & 2 deletions third-party/folly/src/folly/container/test/tape_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct InputRange {
iterator end() const { return iterator{c_.end()}; }
};

#if __has_include(<ranges>)
#if defined(__cpp_lib_ranges)
static_assert(!std::forward_iterator<InputIter<int*>>);
static_assert(std::input_iterator<InputIter<int*>>);
#endif
Expand Down Expand Up @@ -105,7 +105,7 @@ static_assert(
folly::tape<folly::small_vector<int, 4>>::reference>,
"");

#if __has_include(<ranges>)
#if defined(__cpp_lib_ranges)
static_assert(std::ranges::random_access_range<folly::string_tape>);
#endif

Expand Down

0 comments on commit 7d60b12

Please sign in to comment.