COIN-OR::LEMON - Graph Library

Changeset 1205:d3dcc49e6403 in lemon for lemon/opt2_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/opt2_tsp.h

    r1204 r1205  
    231231      ///
    232232      /// This function copies the node sequence of the found tour into
    233       /// the given standard container.
     233      /// an STL container through the given output iterator. The
     234      /// <tt>value_type</tt> of the container must be <tt>FullGraph::Node</tt>.
     235      /// For example,
     236      /// \code
     237      /// std::vector<FullGraph::Node> nodes(countNodes(graph));
     238      /// tsp.tourNodes(nodes.begin());
     239      /// \endcode
     240      /// or
     241      /// \code
     242      /// std::list<FullGraph::Node> nodes;
     243      /// tsp.tourNodes(std::back_inserter(nodes));
     244      /// \endcode
    234245      ///
    235246      /// \pre run() must be called before using this function.
    236       template <typename Container>
    237       void tourNodes(Container &container) const {
    238         container.assign(_path.begin(), _path.end());
     247      template <typename Iterator>
     248      void tourNodes(Iterator out) const {
     249        std::copy(_path.begin(), _path.end(), out);
    239250      }
    240251
Note: See TracChangeset for help on using the changeset viewer.