1.1 --- a/lemon/nearest_neighbor_tsp.h Sun Jan 09 15:06:55 2011 +0100
1.2 +++ b/lemon/nearest_neighbor_tsp.h Thu Feb 28 17:13:14 2013 +0100
1.3 @@ -193,12 +193,23 @@
1.4 /// \brief Gives back the node sequence of the found tour.
1.5 ///
1.6 /// This function copies the node sequence of the found tour into
1.7 - /// the given standard container.
1.8 + /// an STL container through the given output iterator. The
1.9 + /// <tt>value_type</tt> of the container must be <tt>FullGraph::Node</tt>.
1.10 + /// For example,
1.11 + /// \code
1.12 + /// std::vector<FullGraph::Node> nodes(countNodes(graph));
1.13 + /// tsp.tourNodes(nodes.begin());
1.14 + /// \endcode
1.15 + /// or
1.16 + /// \code
1.17 + /// std::list<FullGraph::Node> nodes;
1.18 + /// tsp.tourNodes(std::back_inserter(nodes));
1.19 + /// \endcode
1.20 ///
1.21 /// \pre run() must be called before using this function.
1.22 - template <typename Container>
1.23 - void tourNodes(Container &container) const {
1.24 - container.assign(_path.begin(), _path.end());
1.25 + template <typename Iterator>
1.26 + void tourNodes(Iterator out) const {
1.27 + std::copy(_path.begin(), _path.end(), out);
1.28 }
1.29
1.30 /// \brief Gives back the found tour as a path.