inline void add(const DataStruct& rhs) {
using namespace boost::assign;
vec.reserve(vec.size() + 3);
vec += rhs.a, rhs.b, rhs.c;
}
The
Use only reserve if you know in advance how much place it will use.
Reserve will need to copy your whole vector...
If you do a push_back and the vector is too small, then it will do a reserve (vec.size()*2).
If you don't know beforehand how big your vector is going to be and if you need random access, consider using std::deque.