|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- #include <iostream>
- #include <cctype>
- #include <algorithm>
- #include <iterator>
- #include <vector>
- using namespace std;
- int main()
- {
- char cList[10] = {'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[10] = {'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
- $
复制代码
|
|