본문 바로가기
C++/0x02-boost

boost c++ 라이브러리 사용하기 ][ find iterator

by SpeeDr00t 2016. 8. 1.
반응형

boost c++ 라이브러리 사용하기 ][ find iterator   


■ find iterator 

#include <boost/algorithm/string.hpp>
#include <iostream>
using namespace std;
using namespace boost;
int main( int argc , char ** argv )
{
string str1 = "hello black falcon ab-*-AB-*-aB";
typedef find_iterator<string::iterator> string_find_it;
string_find_it find_it;
for( find_it = make_find_iterator(str1, first_finder("ab", is_iequal()));
find_it != string_find_it();
find_it++)
{
cout << copy_range<std::string>(*find_it) << endl;
}
typedef split_iterator< string::iterator > string_split_it;
string_split_it split_it;
for( split_it = make_split_iterator(str1, first_finder("-*-", is_iequal()));
split_it != string_split_it();
split_it++)
{
cout << copy_range<std::string>(*split_it) << endl;
}
}
view raw boost_find2.cpp hosted with ❤ by GitHub

■ 실행결과

hacker@ubuntu:~/cpp$
hacker@ubuntu:~/cpp$
hacker@ubuntu:~/cpp$
hacker@ubuntu:~/cpp$ c++ -I /home/hacker/boost_1_61_0 -o boost_find2 boost_find2.cpp
hacker@ubuntu:~/cpp$
hacker@ubuntu:~/cpp$
hacker@ubuntu:~/cpp$ ./boost_find2
ab
AB
aB
hello black falcon ab
AB
aB
hacker@ubuntu:~/cpp$
view raw 결과 hosted with ❤ by GitHub


반응형

'C++ > 0x02-boost' 카테고리의 다른 글

boost to_upper_copy  (0) 2016.08.01
boost iterator_range  (0) 2016.08.01
boost replace  (0) 2016.08.01
boost find  (0) 2016.08.01
boost trimming  (0) 2016.08.01