From c528e28a0e34068469a6264009dca102e18a5a4f Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 16 Mar 2020 14:12:04 +1100 Subject: [PATCH] concepts: add "supports_indexing" --- concepts.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/concepts.hpp b/concepts.hpp index 40b02fb7..785d922f 100644 --- a/concepts.hpp +++ b/concepts.hpp @@ -288,6 +288,13 @@ namespace cruft::concepts { }; + template < + typename ContainerT, + typename IndexT = std::size_t + > + concept supports_indexing = requires (ContainerT &t, IndexT idx) { + { t[idx] }; + }; /// A type that supports arithmetic operators.