Ignore:
Timestamp:
Feb 13, 2019, 12:24:12 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
no_list
Children:
80eefcb
Parents:
bbbc067
Message:

Fixed problems with changing some lists to vectors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/utility.h

    rbbbc067 r8d25360  
    9494template< typename SrcContainer, typename DestContainer >
    9595void cloneAll( const SrcContainer &src, DestContainer &dest ) {
    96         typename SrcContainer::const_iterator in = src.begin();
    97         std::back_insert_iterator< DestContainer > out( dest );
    98         while ( in != src.end() ) {
    99                 *out++ = (*in++)->clone();
    100         } // while
     96        std::transform(src.begin(), src.end(), std::back_insert_iterator< DestContainer >( dest ),
     97                [](const typename SrcContainer::value_type & t) -> typename DestContainer::value_type {
     98                        return t->clone();
     99                }
     100        );
    101101}
    102102
     
    464464
    465465// -----------------------------------------------------------------------------
    466 /// Reorders the input range in-place so that the minimal-value elements according to the 
    467 /// comparator are in front; 
     466/// Reorders the input range in-place so that the minimal-value elements according to the
     467/// comparator are in front;
    468468/// returns the iterator after the last minimal-value element.
    469469template<typename Iter, typename Compare>
    470470Iter sort_mins( Iter begin, Iter end, Compare& lt ) {
    471471        if ( begin == end ) return end;
    472        
     472
    473473        Iter min_pos = begin;
    474474        for ( Iter i = begin + 1; i != end; ++i ) {
Note: See TracChangeset for help on using the changeset viewer.