StringStream
StringStream is another string-like stream object provided by C + +, which has a similar operation as the iostream and FStream previously learned. To use StringStream, you must first join this line:
#include <sstream>
StringStream is mainly used in the division of a string, you can first use clear () and STR () to set the specified string to the beginning of the content, and then use the >> to the other data output, for example:
String S;stringstream ss;int A, B, C;getline (CIN, s); Ss.clear (); Ss.str (s); SS >> a >> b >> c;
#include <string>
#include <sstream>
#include <iostream>
int main ()
{
Std::stringstream stream;
std::string result;
int i = 1000;
Stream << i; the int input stream
Stream >> result; Extracts the previously inserted int value from the stream
Std::cout << result << Std::endl; Print the string "1000"
}
=========
Remove all elements less than 100
Arr.erase (Std::remove_if (Arr.begin (), Arr.end (),
std::bind2nd(std::less< int> (), +), arr.end ());
The comparison expression here is equivalent to Arr.value < 100
If you use bind1st, you mean the opposite.
To remove all elements greater than 100
Arr.erase (Std::remove_if (Arr.begin (), Arr.end (),
std::bind1st(std::less< int> (), +), arr.end ());
The expression here is equivalent to < Arr.value
==============
C + + Knowledge point Rollup