COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
02/28/13 17:13:14 (7 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/christofides_tsp.h

    r1204 r1205  
    210210      ///
    211211      /// This function copies the node sequence of the found tour into
    212       /// the given standard container.
    213       ///
    214       /// \pre run() must be called before using this function.
    215       template <typename Container>
    216       void tourNodes(Container &container) const {
    217         container.assign(_path.begin(), _path.end());
     212      /// an STL container through the given output iterator. The
     213      /// <tt>value_type</tt> of the container must be <tt>FullGraph::Node</tt>.
     214      /// For example,
     215      /// \code
     216      /// std::vector<FullGraph::Node> nodes(countNodes(graph));
     217      /// tsp.tourNodes(nodes.begin());
     218      /// \endcode
     219      /// or
     220      /// \code
     221      /// std::list<FullGraph::Node> nodes;
     222      /// tsp.tourNodes(std::back_inserter(nodes));
     223      /// \endcode
     224      ///
     225      /// \pre run() must be called before using this function.
     226      template <typename Iterator>
     227      void tourNodes(Iterator out) const {
     228        std::copy(_path.begin(), _path.end(), out);
    218229      }
    219230     
Note: See TracChangeset for help on using the changeset viewer.