Benjamin Bannier created MESOS-6560:
---------------------------------------

             Summary: The default stout stringify always copies its argument
                 Key: MESOS-6560
                 URL: https://issues.apache.org/jira/browse/MESOS-6560
             Project: Mesos
          Issue Type: Bug
          Components: stout
            Reporter: Benjamin Bannier


The default implementation of the template {{stringify}} in stout always copies 
its argument,
{code}
template <typename T> std::string stringify(T t)
{code}

For most types implementing a dedicated {{stringify}} we restrict {{T}} to some 
{{const}} ref with the exception of the specialization for {{bool}},
{code}
template <> std::string stringify(const bool& b)
{code}

Copying by default is bad since it requires {{T}} to be copyable without 
{{stringify}} actually requiring this. It also likely leads to bad performance.

This issue was first pointed out by coverity way back on 2012-09-21.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to