diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-03-15 08:20:37 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-03-15 08:20:37 +0200 |
commit | 6664a24b003f3959e2efe2893628f725a5f6746f (patch) | |
tree | 9c0c9453c6cb04d51f4e969f5843e8c0648408bc /cutl/container/graph.txx | |
parent | dac3640ed08cf18eaa6eb26605a27e6c7387b2c2 (diff) |
Add non-const versions of new_node() in graph container
Diffstat (limited to 'cutl/container/graph.txx')
-rw-r--r-- | cutl/container/graph.txx | 35 |
1 files changed, 35 insertions, 0 deletions
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 <typename N, typename E> + template <typename T, typename A0> + T& graph<N, E>:: + new_node (A0& a0) + { + shared_ptr<T> node (new (shared) T (a0)); + nodes_[node.get ()] = node; + + return *node; + } + + + template <typename N, typename E> + template <typename T, typename A0, typename A1> + T& graph<N, E>:: + new_node (A0& a0, A1& a1) + { + shared_ptr<T> node (new (shared) T (a0, a1)); + nodes_[node.get ()] = node; + + return *node; + } + + template <typename N, typename E> + template <typename T, typename A0, typename A1, typename A2> + T& graph<N, E>:: + new_node (A0& a0, A1& a1, A2& a2) + { + shared_ptr<T> node (new (shared) T (a0, a1, a2)); + nodes_[node.get ()] = node; + + return *node; + } // Edges. // |