之前一直没有使用过vector<struct>,如今就写一个简短的代码: #include <vector> #include <iostream> int main() { struct st { int a; }; std::vector<st> v; v.resize(4); for (std::vector<st>::size_type i = 0; i < v.size(); i++) { v.operator[](i).a =…
使用vector容器,即避免不了进行查找,所以今天就罗列一些stl的find算法应用于vector中. find() Returns an iterator to the first element in the range [first,last) that compares equal to val. If no such element is found, the function returns last. #include <iostream> // std::cout #inclu…