Skip to content

Commit

Permalink
Add guards for <format>
Browse files Browse the repository at this point in the history
  • Loading branch information
neatudarius committed Jun 19, 2024
1 parent 777ddb1 commit 77fb8da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/Beman/Optional26/optional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ namespace std {
*/

#include <compare>
#if defined(__cpp_lib_format_ranges)
#include <format>
#endif
#include <functional>
#include <ranges>
#include <type_traits>
Expand Down Expand Up @@ -214,7 +216,6 @@ template <typename T>
inline constexpr bool ranges::enable_borrowed_range<beman::optional::optional<T&>> = true;

// Since P3168R1: Give std::optional Range Support.
// TODO: Always enable when all major compilers implement P2585R1: "Improve default container formatting".
#if defined(__cpp_lib_format_ranges)
template <class T>
inline constexpr auto format_kind<beman::optional::optional<T>> = range_format::disabled;
Expand Down
2 changes: 2 additions & 0 deletions src/Beman/Optional26/tests/optional_range_support.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#include <Beman/Optional26/optional.hpp>

#include <algorithm>
#if defined(__cpp_lib_format_ranges)
#include <format>
#endif
#include <functional>
#include <ranges>
#include <tuple>
Expand Down

0 comments on commit 77fb8da

Please sign in to comment.