Changeset 3239


Ignore:
Timestamp:
May 24, 2014, 3:30:49 PM (9 years ago)
Author:
Peter
Message:

prefer range constructor over copy range with std::copy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/statistics/utility.h

    r3236 r3239  
    437437    using std::iterator_traits;
    438438    typedef typename iterator_traits<RandomAccessIterator>::value_type value_t;
    439     std::vector<value_t> v_copy;
    440     v_copy.reserve(std::distance(first,last));
    441     std::copy(first, last, std::back_inserter(v_copy));
     439    std::vector<value_t> v_copy(first, last);
    442440    size_t i = static_cast<size_t>(p/100 * (v_copy.size()-1));
    443441    if (i+2 < v_copy.size()) {
Note: See TracChangeset for help on using the changeset viewer.