Skip to content

Commit 713d88f

Browse files
committed
Use contiguous_range when available
1 parent 879463e commit 713d88f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/fmt/base.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
# include <type_traits> // std::enable_if
2121
#endif
2222

23+
#if defined(__cpp_lib_ranges)
24+
# include <ranges>
25+
#endif
26+
2327
// The fmt library version in the form major * 10000 + minor * 100 + patch.
2428
#define FMT_VERSION 120101
2529

@@ -588,7 +592,12 @@ template <typename T> class basic_appender;
588592
using appender = basic_appender<char>;
589593

590594
// Checks whether T is a container with contiguous storage.
595+
#if defined(__cpp_lib_ranges)
596+
template <typename T>
597+
struct is_contiguous : std::bool_constant<std::ranges::contiguous_range<T>> {};
598+
#else
591599
template <typename T> struct is_contiguous : std::false_type {};
600+
#endif
592601

593602
class context;
594603
template <typename OutputIt, typename Char> class generic_context;

0 commit comments

Comments
 (0)