728x90 C, C++/Header2 sstream [stringstream] #include stringstream 설명 sstream 은 string stream 의 약자이다. string stream 는 주어진 어떠한 문자열에서 원하는 자료형으로 정보를 얻을 수 있다. 또한 여러가지 자료형을 가진 데이터들이 들어올 때 효과적으로 관리를 할 수 있다. stringstream 은 저장이 된 문자열에서 공백(' ')과 줄바꿈('\n') 을 기준으로 문자열을 구분하여 처리한다. 1) 문자열에 대해서 띄어쓰기를 기준으로 원하는 자료형으로 분리를 할 수 있다. #include #include using namespace std; int main() { string out; string strInput = "Hello world hello C++"; stringstream s_stream.. 2021. 8. 29. lower_bound, upper_bound lower_bound & upper_bound std::lower_bound - cppreference.com std::upper_bound - cppreference.com Definition lower_bound : 찾고자 하는 값 이상의 수가 처음으로 나오는 곳의 index를 구할때 사용 upper_bound : 찾고자 하는 값보다 큰 수가 처음으로 나오는 곳의 index를 구할때 사용 How to use Binary search를 기반으로 탐색되므로, 탐색되는 vector 혹은 list 는 sort 되어있어야 한다. lower_bound, upper_bound는 구하고자 하는 곳의 iterator를 return 한다. 따라서 실제로 사용할 경우 구한 lower_bound 혹은 upper_bound.. 2021. 2. 4. 이전 1 다음 728x90