I have a function that processes a given vector, but may also create such a vector itself if it is not given.
I see two design choices for such a case, where a func
I usually avoid the first case. Note that those two functions are different in what they do. One of them fills a vector with some data. The other doesn't (just accept the data from the caller). I tend to name differently functions that actually do different things. In fact, even as you write them, they are two functions:
foo_default (or just foo)foo_with_valuesAt least I find this distinction cleaner in the long therm, and for the occasional library/functions user.