]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/partcache.h
Convert all list containers to vectors
[libs/gltk.git] / source / partcache.h
index 9dc71bf184c8652de6b5e4939a8bab9224a2f512..71684738f0980922de8db5346d88249f53a058b5 100644 (file)
@@ -12,11 +12,13 @@ class Part;
 
 struct CachedPart
 {
-       const Part *part;
-       const GL::Texture2D *texture;
-       GL::Mesh *mesh;
+       const Part *part = nullptr;
+       const GL::Texture2D *texture = nullptr;
+       GL::Mesh *mesh = nullptr;
 
-       CachedPart();
+       CachedPart() = default;
+       CachedPart(CachedPart &&);
+       CachedPart &operator=(CachedPart &&);
        ~CachedPart();
 };
 
@@ -33,23 +35,19 @@ public:
                ~Rebuild() { cache.end_rebuild(); }
        };
 
-       typedef std::list<CachedPart> PartList;
-
 private:
-       bool rebuilding;
-       PartList parts;
-       PartList::iterator next;
-       PartList::iterator current;
+       bool rebuilding = false;
+       std::vector<CachedPart> parts;
+       std::vector<CachedPart>::iterator next;
+       std::vector<CachedPart>::iterator current;
 
 public:
-       PartCache();
-
        void begin_rebuild();
        void insert_special(const Part &);
        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