#include #include #include using namespace std; template void print(const list &lst) { for (typename list::const_iterator it = lst.begin(); it != lst.end(); ++it) cout << *it << ' '; cout << endl; } int main() { list lst1(6, 5); // 6 个 5 print(lst1); string s1 = "abcdefg"; // 将 string 字符串转换为 list list lst2(s1.begin(), s1.end()); print(lst2); return 0; }