diff OrthancStone/Sources/Scene2D/MacroSceneLayer.h @ 1793:c5e6379b9cd0

fix build
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 17 May 2021 17:23:54 +0200
parents 9b650ab68d4c
children 20a0aba0ede5
line wrap: on
line diff
--- a/OrthancStone/Sources/Scene2D/MacroSceneLayer.h	Mon May 17 16:59:03 2021 +0200
+++ b/OrthancStone/Sources/Scene2D/MacroSceneLayer.h	Mon May 17 17:23:54 2021 +0200
@@ -26,7 +26,7 @@
 
 #include <Compatibility.h>  // For ORTHANC_OVERRIDE
 
-#include <vector>
+#include <deque>
 
 namespace OrthancStone
 {
@@ -37,8 +37,10 @@
   class MacroSceneLayer : public ISceneLayer
   {
   private:
-    std::vector<ISceneLayer*>  layers_;
-    uint64_t                   revision_;
+    // A deque is used because we need to quickly add new layers, and
+    // to randomly access the layers
+    std::deque<ISceneLayer*>  layers_;
+    uint64_t                  revision_;
 
   protected:
     void BumpRevision()
@@ -60,12 +62,7 @@
 
     void Clear();      
 
-    void Reserve(size_t size)
-    {
-      layers_.reserve(size);
-    }
-
-    void AddLayer(ISceneLayer* layer);  // takes ownership
+    size_t AddLayer(ISceneLayer* layer);  // takes ownership
 
     size_t GetSize() const
     {