OK, I pushed variant that only does the replacement for the first
if necessary. Since for the other entries it really shouldn't be
That's good for now.
+ _base::push_back (*first != NULL ? std::string (*first) :
+ _base::insert (_base::end (), ++first, other.end ());
I'll mention some C++ arcana you might not have noticed here. We just
don't care about the microoptimization details right here, but for
The type of:
(*first != NULL ? std::string (*first) : "")
is std::string. So really it's doing:
(*first != NULL ? std::string (*first) : std::string (""))
by implicit type coercion. Hence, you might as well write:
std::string (*first ?: "")
to do that.
But, here (I think!) you can pass a const char * to push_back instead.
_base::push_back (*first ?: "");
If that does work, then I think it may well avoid a copy-construct+destruct
of a temporary std::string object.