COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
02/28/13 17:13:14 (11 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Use output iterator instead of a container (#386)
in tourNodes() functions of TSP algorithms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/nearest_neighbor_tsp.h

    r1204 r1205  
    194194      ///
    195195      /// This function copies the node sequence of the found tour into
    196       /// the given standard container.
    197       ///
    198       /// \pre run() must be called before using this function.
    199       template <typename Container>
    200       void tourNodes(Container &container) const {
    201         container.assign(_path.begin(), _path.end());
     196      /// an STL container through the given output iterator. The
     197      /// <tt>value_type</tt> of the container must be <tt>FullGraph::Node</tt>.
     198      /// For example,
     199      /// \code
     200      /// std::vector<FullGraph::Node> nodes(countNodes(graph));
     201      /// tsp.tourNodes(nodes.begin());
     202      /// \endcode
     203      /// or
     204      /// \code
     205      /// std::list<FullGraph::Node> nodes;
     206      /// tsp.tourNodes(std::back_inserter(nodes));
     207      /// \endcode
     208      ///
     209      /// \pre run() must be called before using this function.
     210      template <typename Iterator>
     211      void tourNodes(Iterator out) const {
     212        std::copy(_path.begin(), _path.end(), out);
    202213      }
    203214
Note: See TracChangeset for help on using the changeset viewer.