diff --git a/src/tree/param.cc b/src/tree/param.cc index edb6156163b9..8049501ea094 100644 --- a/src/tree/param.cc +++ b/src/tree/param.cc @@ -3,18 +3,20 @@ */ #include #include +#include #include "param.h" namespace std { std::istream &operator>>(std::istream &is, std::vector &t) { + t.clear(); // get ( while (true) { char ch = is.peek(); if (isdigit(ch)) { int idx; if (is >> idx) { - t.assign(&idx, &idx + 1); + t.emplace_back(idx); } return is; } @@ -73,7 +75,7 @@ std::istream &operator>>(std::istream &is, std::vector &t) { return is; } } - t.assign(tmp.begin(), tmp.end()); + t = std::move(tmp); return is; } } // namespace std diff --git a/src/tree/param.h b/src/tree/param.h index 708e57e56248..7c858c975284 100644 --- a/src/tree/param.h +++ b/src/tree/param.h @@ -2,7 +2,7 @@ * Copyright 2014 by Contributors * \file param.h * \brief training parameters, statistics used to support tree construction. -n * \author Tianqi Chen + * \author Tianqi Chen */ #ifndef XGBOOST_TREE_PARAM_H_ #define XGBOOST_TREE_PARAM_H_