I try to remove the spaces from a string
using an old trick that involves an
istringstream object. I expect the while-condition
while(istringstream>>string) to evaluate to
false once the istringstream is exhausted, but
that is not the case. What am I missing?
#include<iostream>
#include<sstream>
#include<string>
static std::string s="Asymmetric Beards, \
Not Even Punk Rockers Have One!";
int main(int,char**)
{
std::istringstream a(s);
std::string b;
while(a>>b)std::cout<<b.c_str();
return 0;
}
.......
output
AsymmetricBeards,NotEvenPunkRockersHaveOne!One!One !One!One!One!One!...
-X