diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-01-02 15:04:50 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-01-02 15:04:50 +0000 |
commit | a3596b582d300dad07fc1c536efa486a9cbd8b79 (patch) | |
tree | 51a447a261abe8155119984e9816c374f545489f /lib/collections.hpp | |
parent | Allow operator*= on spans, not just arrays (diff) | |
download | ilt-a3596b582d300dad07fc1c536efa486a9cbd8b79.tar.bz2 ilt-a3596b582d300dad07fc1c536efa486a9cbd8b79.tar.xz ilt-a3596b582d300dad07fc1c536efa486a9cbd8b79.zip |
Add a concept for sequential collections suitable for passing to OpenGL
Diffstat (limited to 'lib/collections.hpp')
-rw-r--r-- | lib/collections.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/collections.hpp b/lib/collections.hpp index b87cda3..5d39e79 100644 --- a/lib/collections.hpp +++ b/lib/collections.hpp @@ -3,6 +3,16 @@ #include <array> #include <span> +template<typename T, typename E> +concept SequentialCollection = requires(T c) { + { + c.size() + } -> std::integral; + { + c.data() + } -> std::same_as<const E *>; + }; + template<typename T, std::size_t first, std::size_t second> constexpr std::array<T, first + second> operator+(const std::array<T, first> & a, const std::array<T, second> & b) |