// algo/algostuff.hpp #ifndef ALGOSTUFF_HPP #define ALGOSTUFF_HPP #include #include #include #include #include #include #include #include #include #include /* PRINT_ELEMENTS() * - вывод необязательной строки C, за которой выводятся * - все элементы коллекции coll, разделенные пробелами. */ template inline void PRINT_ELEMENTS (const T& coll, const char* optcstr="") { typename T::const_iterator pos; std::cout << optcstr; for (pos=coll.begin(); pos!=coll.end(); ++pos) { std::cout << *pos << ' '; } std::cout << std::endl; } /* INSERT_ELEMENTS (collection, first, last) * - заполнение коллекции значениями от first до last * - ВНИМАНИЕ: интервал НЕ ЯВЛЯЕТСЯ полуоткрытым */ template inline void INSERT_ELEMENTS (T& coll, int first, int last) { for (int i=first; i<=last; ++i) { coll.insert(coll.end(),i); } } #endif /*ALGOSTUFF_HPP*/