From 6664a24b003f3959e2efe2893628f725a5f6746f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 15 Mar 2013 08:20:37 +0200 Subject: Add non-const versions of new_node() in graph container --- cutl/container/graph.hxx | 14 ++++++++++++++ cutl/container/graph.txx | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/cutl/container/graph.hxx b/cutl/container/graph.hxx index f803797..9c1afe2 100644 --- a/cutl/container/graph.hxx +++ b/cutl/container/graph.hxx @@ -86,6 +86,20 @@ namespace cutl new_node (A0 const&, A1 const&, A2 const&, A3 const&, A4 const&, A5 const&, A6 const&, A7 const&, A8 const&, A9 const&); + // Non-const versions. + // + template + T& + new_node (A0&); + + template + T& + new_node (A0&, A1&); + + template + T& + new_node (A0&, A1&, A2&); + public: template T& diff --git a/cutl/container/graph.txx b/cutl/container/graph.txx index 666f94a..bb8fe47 100644 --- a/cutl/container/graph.txx +++ b/cutl/container/graph.txx @@ -155,6 +155,41 @@ namespace cutl return *node; } + // Non-const versions. + // + template + template + T& graph:: + new_node (A0& a0) + { + shared_ptr node (new (shared) T (a0)); + nodes_[node.get ()] = node; + + return *node; + } + + + template + template + T& graph:: + new_node (A0& a0, A1& a1) + { + shared_ptr node (new (shared) T (a0, a1)); + nodes_[node.get ()] = node; + + return *node; + } + + template + template + T& graph:: + new_node (A0& a0, A1& a1, A2& a2) + { + shared_ptr node (new (shared) T (a0, a1, a2)); + nodes_[node.get ()] = node; + + return *node; + } // Edges. // -- cgit v1.1