Changeset 4096
- Timestamp:
- Sep 17, 2021, 1:24:28 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/getvector.h
r3930 r4096 30 30 #include <istream> 31 31 #include <string> 32 #include <utility> 32 33 #include <vector> 33 34 … … 68 69 69 70 template<typename T> 70 void convert(std::vector<std::string>& vec,71 void convert(std::vector<std::string>&& vec, 71 72 std::vector<T>& result, boost::true_type is_string) 72 73 { 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); 76 75 } 77 76 78 77 79 78 template<typename T> 80 void convert( std::vector<std::string>& vec,79 void convert(const std::vector<std::string>& vec, 81 80 std::vector<T>& result, boost::false_type is_string) 82 81 { … … 101 100 split(vec, line, delim); 102 101 typename boost::is_same<T, std::string> is_string; 103 convert( vec, result, is_string);102 convert(std::move(vec), result, is_string); 104 103 return is; 105 104 }
Note: See TracChangeset
for help on using the changeset viewer.