Changeset 4096


Ignore:
Timestamp:
Sep 17, 2021, 1:24:28 AM (2 years ago)
Author:
Peter
Message:

simplify code and alter private interface to reflect what's going on inside

File:
1 edited

Legend:

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

    r3930 r4096  
    3030#include <istream>
    3131#include <string>
     32#include <utility>
    3233#include <vector>
    3334
     
    6869
    6970    template<typename T>
    70     void convert(std::vector<std::string>& vec,
     71    void convert(std::vector<std::string>&& vec,
    7172                 std::vector<T>& result, boost::true_type is_string)
    7273    {
    73       // swap only swaps couple pointers, hence almost free. Do not us
    74       // vec after this point.
    75       std::swap(vec, result);
     74      result = std::move(vec);
    7675    }
    7776
    7877
    7978    template<typename T>
    80     void convert(std::vector<std::string>& vec,
     79    void convert(const std::vector<std::string>& vec,
    8180                 std::vector<T>& result, boost::false_type is_string)
    8281    {
     
    101100      split(vec, line, delim);
    102101      typename boost::is_same<T, std::string> is_string;
    103       convert(vec, result, is_string);
     102      convert(std::move(vec), result, is_string);
    104103      return is;
    105104    }
Note: See TracChangeset for help on using the changeset viewer.