diff --git a/doc/tutorial/02_cube.cpp b/doc/tutorial/02_cube.cpp index d1feffe5..8beaae6d 100644 --- a/doc/tutorial/02_cube.cpp +++ b/doc/tutorial/02_cube.cpp @@ -44,9 +44,11 @@ public: Ticker::Unref(m_camera); } + struct vertex { vec3 pos, color; }; + virtual bool init_draw() override { - array mesh + array mesh { // Front vertices/colors { vec3(-1.0, -1.0, 1.0), vec3(1.0, 0.0, 1.0) }, diff --git a/doc/tutorial/07_input.cpp b/doc/tutorial/07_input.cpp index b19044f7..3cd1a202 100644 --- a/doc/tutorial/07_input.cpp +++ b/doc/tutorial/07_input.cpp @@ -100,9 +100,11 @@ public: m_matrix = proj * view * model * anim; } + struct vertex { vec3 pos, color; }; + virtual bool init_draw() override { - array mesh + array mesh { // Front vertices/colors { vec3(-1.0, -1.0, 1.0), vec3(1.0, 0.0, 1.0) }, diff --git a/src/lol/base/array.h b/src/lol/base/array.h index bac6106b..98002a95 100644 --- a/src/lol/base/array.h +++ b/src/lol/base/array.h @@ -444,6 +444,14 @@ class array : public array_base, array> private: using array_base, array>::array_base; + // Mark these as private: it’s dangerous to use data() with arrays of + // tuples because no assumption should be made about the tuple layout, + // not even the order of its members in memory. + inline void data() {} + inline void data() const {} + inline void bytes() {} + inline void bytes() const {} + public: // GCC needs this but Clang doesn’t typedef std::tuple element_t;