summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-01-02 15:04:50 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-01-02 15:04:50 +0000
commita3596b582d300dad07fc1c536efa486a9cbd8b79 (patch)
tree51a447a261abe8155119984e9816c374f545489f /lib
parentAllow operator*= on spans, not just arrays (diff)
downloadilt-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')
-rw-r--r--lib/collections.hpp10
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)