]> granicus.if.org Git - graphviz/commitdiff
add GVLayout constructor overload, passing the context and the graph as rvalue refs
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Wed, 7 Jul 2021 12:17:43 +0000 (14:17 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Sat, 7 Aug 2021 09:08:50 +0000 (11:08 +0200)
lib/gvc++/GVLayout.cpp
lib/gvc++/GVLayout.h

index 63159e7bf604b16360e5bac82e70394fda9d981e..7ebad6f86fe86fdc96210d9becd01eb70ed455ad 100644 (file)
@@ -25,6 +25,11 @@ GVLayout::GVLayout(const std::shared_ptr<GVContext> &gvc,
   }
 }
 
+GVLayout::GVLayout(GVContext &&gvc, CGraph::AGraph &&g,
+                   const std::string &engine)
+    : GVLayout(std::make_shared<GVContext>(std::move(gvc)),
+               std::make_shared<CGraph::AGraph>(std::move(g)), engine) {}
+
 GVLayout::~GVLayout() {
   // m_gvc and m_g always either both point to an object or both are null
   assert((m_gvc != nullptr && m_g != nullptr) ||
index 1c1d43bf6d64690b0e1358ec80e3c802a880dc38..9f851bffc73ecee300bed2dfc8d2a08957a8dbba 100644 (file)
@@ -26,6 +26,7 @@ class GVLAYOUT_API GVLayout {
 public:
   GVLayout(const std::shared_ptr<GVContext> &gvc,
            const std::shared_ptr<CGraph::AGraph> &g, const std::string &engine);
+  GVLayout(GVContext &&gvc, CGraph::AGraph &&g, const std::string &engine);
   ~GVLayout();
 
   // default copy since we manage resources through movable types