]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/partcache.h
Convert all list containers to vectors
[libs/gltk.git] / source / partcache.h
index 137bce4c37539a8c032f27b36cff0c35afc89f58..71684738f0980922de8db5346d88249f53a058b5 100644 (file)
@@ -16,6 +16,9 @@ struct CachedPart
        const GL::Texture2D *texture = nullptr;
        GL::Mesh *mesh = nullptr;
 
+       CachedPart() = default;
+       CachedPart(CachedPart &&);
+       CachedPart &operator=(CachedPart &&);
        ~CachedPart();
 };
 
@@ -32,13 +35,11 @@ public:
                ~Rebuild() { cache.end_rebuild(); }
        };
 
-       typedef std::list<CachedPart> PartList;
-
 private:
        bool rebuilding = false;
-       PartList parts;
-       PartList::iterator next;
-       PartList::iterator current;
+       std::vector<CachedPart> parts;
+       std::vector<CachedPart>::iterator next;
+       std::vector<CachedPart>::iterator current;
 
 public:
        void begin_rebuild();
@@ -46,7 +47,7 @@ public:
        GL::Mesh &create_mesh(const Part &, const GL::Texture2D &);
        void end_rebuild();
 
-       const PartList &get_parts() const { return parts; }
+       const std::vector<CachedPart> &get_parts() const { return parts; }
 };
 
 } // namespace GLtk