给定一个包含MyClass对象的std::vector。如何使用std::copy创建另一个仅包含MyClass成员数据的向量?我想我必须实现一个自定义的back_inserter,但是到目前为止我还不知道该怎么做。copy that to another vector of type MyClass using std::copy.
std::copy(vec1.begin(), vec1.end(); std::back_inserter<
我大致有以下代码,用于将唯一的段索引收集到uniques中 // segments vector is filled in hereuniques.push_back( segments[ i ] );#endif
当定义了USE_STD_UNIQUE_COPY时,代码就会失败;当它未定义时,它将按预期的方式工作不管怎么说,根据cp首选项,std::unique_copy (1)应该做代码的#else部分所做的事情