> OK, I pushed variant that only does the replacement for the first entry
> if necessary. Since for the other entries it really shouldn't be
> necessary.

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
future reference.  

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.
i.e.
        _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.


Thanks,
Roland
_______________________________________________
elfutils-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/elfutils-devel

Reply via email to