Skip to content

Commit

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

Pull Request resolved: #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 51c4605 commit 323e467
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion 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 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 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 323e467

Please sign in to comment.