c++使用cctype的isupper报错
#include <iostream>#include <cctype>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;
int main()
{
char cList = {'a', 'i', 'C', 'd', 'e',
'f', 'o', 'H', 'u', 'j'};
vector<char> charList(cList, cList + 10);
vector<char>::iterator position;
position = find_if(charList.begin(), charList.end(), isupper);
return 0;
}
你为什么要禁用C++的名字空间?
C++为什么要引入名字空间?是为了解决什么问题?
$ cat main.cpp
#include <algorithm>
#include <cctype>
#include <iostream>
#include <iterator>
#include <vector>
int main() {
char cList = {'a', 'i', 'C', 'd', 'e', 'f', 'o', 'H', 'u', 'j'};
std::vector<char> charList(cList, cList + 10);
std::vector<char>::iterator position;
position = find_if(charList.begin(), charList.end(), isupper);
std::cout << position - charList.begin() << std::endl;
return 0;
}
$ g++-debug -o main main.cpp
$ ./main
2
$
页:
[1]