diff --git a/concepts.hpp b/concepts.hpp index ddf1c7f5..4a9aa9d1 100644 --- a/concepts.hpp +++ b/concepts.hpp @@ -251,6 +251,23 @@ namespace cruft::concepts { #include namespace cruft::concepts { + /// Tests if the type has all typedefs required for use with + /// std::iterator_traits. + template + concept supports_iterator_traits = requires + { + typename T::difference_type; + typename T::value_type; + typename T::reference; + typename T::iterator_category; + + // C++20 defines `pointer` as void if it's not present. + #if __cplusplus <= 201703L + typename T::pointer; + #endif + }; + + template concept arithmetic = std::is_arithmetic_v;