lundi 14 juin 2021

How to use ostringstream as a default arguement?

I have a function

func(parameter 1, parameter 2);

Now, I'm trying to add additional functionality for which I want to pass ostringstream as a 3rd parameter.

func(parameter 1, parameter 2, ostringstream& abc); The problem is this function is called many times in codebase and in some places it is to be called without ostringstream.

So, I was trying to set default parameter for ostringstream but can't find a way.

Can somebody help? Don't worry about function body, I'm making sure that I do not use ostringstream if it wasn't present while calling the function.

Aucun commentaire:

Enregistrer un commentaire