forward_list
我写了一个简单的C++ 程序,它依赖于
#include <forward_list>
#include <iostream>
int main() {
std::forward_list<int> my_list;
my_list.push_front(3);
std::cout << my_list.top() << std::endl;
return 0;
}
然而,当我在我的 Mac 上编译这个程序时clang++ my_program.cpp -std=c++11 -o my_program
,我得到了这个错误:
my_program.cpp:1:14: fatal error: 'forward_list' file not found
#include <forward_list>
^
1 error generated.
为什么clang找不到forward_list
?其他 C++11 功能正在运行。例如,auto
关键字有效,尽管出现了一个警告,告诉我这auto
是 C++11 功能。