COIN-OR::LEMON - Graph Library

Changeset 1205:d3dcc49e6403 in lemon for lemon/insertion_tsp.h


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/insertion_tsp.h

    r1204 r1205  
    204204      ///
    205205      /// This function copies the node sequence of the found tour into
    206       /// the given standard container.
     206      /// an STL container through the given output iterator. The
     207      /// <tt>value_type</tt> of the container must be <tt>FullGraph::Node</tt>.
     208      /// For example,
     209      /// \code
     210      /// std::vector<FullGraph::Node> nodes(countNodes(graph));
     211      /// tsp.tourNodes(nodes.begin());
     212      /// \endcode
     213      /// or
     214      /// \code
     215      /// std::list<FullGraph::Node> nodes;
     216      /// tsp.tourNodes(std::back_inserter(nodes));
     217      /// \endcode
    207218      ///
    208219      /// \pre run() must be called before using this function.
    209       template <typename Container>
    210       void tourNodes(Container &container) const {
    211         container.assign(_tour.begin(), _tour.end());
     220      template <typename Iterator>
     221      void tourNodes(Iterator out) const {
     222        std::copy(_tour.begin(), _tour.end(), out);
    212223      }
    213224
Note: See TracChangeset for help on using the changeset viewer.