读书人

c++0x的新特性dev c++是不支持?解决

发布时间: 2012-05-27 05:42:30 作者: rapoo

c++0x的新特性,dev c++是不支持?
要用什么编译器,还是要下载新的库?
比如

C/C++ code
// std_tr1__array__array_array.cpp // compile with: /EHsc #include <array> #include <iostream>  typedef std::array<int, 4> Myarray; int main()     {     Myarray c0 = {0, 1, 2, 3};  // display contents " 0 1 2 3"     for (Myarray::const_iterator it = c0.begin();         it != c0.end(); ++it)         std::cout << " " << *it;     std::cout << std::endl;      Myarray c1(c0);  // display contents " 0 1 2 3"     for (Myarray::const_iterator it = c1.begin();         it != c1.end(); ++it)         std::cout << " " << *it;     std::cout << std::endl;      return (0);     } 

用的tr1 array
C/C++ code
#include <algorithm>#include <functional>#include <iostream>#include <vector>struct LessThan7 : std::unary_function<int, bool>{    bool operator()(int i) const { return i < 7; }}; int main(){    std::vector<int> v;    for (int i = 0; i < 10; ++i) {        v.push_back(i);    }     std::cout << std::count_if(v.begin(), v.end(), std::not1(LessThan7())) << "\n";     //same as above, but use a lambda function    std::function<int(int)> less_than_9 = [](int x){ return x < 9; };    std::cout << std::count_if(v.begin(), v.end(), std::not1(less_than_9)) << "\n"; }

用的lamda表达式,也无法编译运行。

是要用vs2010吗?还是要下个新的库什么的?还是dev上的库太旧了?该怎么办?

[解决办法]
gcc 4.4以上
VS2010以上

dev cpp用的是gcc 3.4.3或3.4.5,05年左右的,比较老了,而且ide也不好用,devcpp这个开源项目早就没人维护了

读书人网 >C++

热点推荐