I m目前概述了C++11的新特征,目前原因不明,其中一些没有汇编。 根据海合会的联邦武装部队情况,我使用46.020100703(experimental)(GCC)版本,我所尝试的所有特征都是支持。 我试图用 st升到C++0x和 st=gnu++0x旗进行汇编。
Non member begin() & end()
例如,我wan不使用非成员,开始()和结束(),其成文法如下:
#include <iostream>
#include <map>
#include <utility>
#include <iterator>
using namespace std;
int main ( ) {
map < string, string > alias;
alias.insert ( pair < string, string > ( "ll", "ls -al" ) );
// ... Other inserts
auto it = begin(alias);
while ( it != end(alias) ) {
//...
}
而且,我知道,
nonMemberBeginEnd//main.cc:15:24: error: ‘begin’ was not declared in this scope
nonMemberBeginEnd//main.cc:15:24: error: unable to deduce ‘auto’ from ‘<expression error>’ // Ok, this one is normal.
nonMemberBeginEnd//main.cc:16:26: error: ‘end’ was not declared in this scope
我是否需要包括特别负责人?
For range
My second (and last) question is weirder because It cannot depend on black magic hidden header that I might had not included.
The following Code :
for ( auto kv : alias )
cout << kv.first << " ~ " << kv.second << endl;
下面的错误:
rangeFor/main.cc:15:17: error: expected initializer before ‘:’ token
我希望,我的问题不会成为你们的gu,也不要 too,你们会帮助我发现什么错误。