streamstring

Sep 9, 2016 at 2:25am
A streadstring is not a string right?

So for initializing what do I set it to?

stringstream strs = what?

for a string it would be = "" for the basic initialization to the declaration.
Last edited on Sep 9, 2016 at 2:26am
Sep 9, 2016 at 2:32am
Tried std::stringstream strs("SomeString")?
Sep 10, 2016 at 3:38am
so std::stringsteam strs("") is okay?
Sep 10, 2016 at 3:55am
If you want it to be empty just use the default constructor:
std::ostringstream oss; //empty
Sep 10, 2016 at 5:09am
But my compiler is giving a warning about using an uninitialized stringsteam when I set strs << "something

and each other instances I use operators of it to store more data.
Sep 10, 2016 at 9:34pm
LB, isn't that a declaration and not an initialization?
Sep 10, 2016 at 10:09pm
The default constructor will initialize itself to just be empty, you don't have to provide an initial value for it.
Sep 10, 2016 at 10:47pm
nikki1337 wrote:
LB, isn't that a declaration and not an initialization?
A declaration would use the extern keyword. Generally it is uncommon to declare without also initializing - only primitive types have weird behavior.
Sep 11, 2016 at 3:48am
Why would ss << "Something" provide a compiler error that ss is being used before initialization?
Topic archived. No new replies allowed.