[
https://issues.apache.org/jira/browse/MESOS-6560?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Benjamin Bannier updated MESOS-6560:
------------------------------------
Description:
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 detected by Coverity in CID 727974 way back on 2012-09-21.
was:
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.
> 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
> Labels: coverity, tech-debt
>
> 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 detected by Coverity in CID 727974 way back on
> 2012-09-21.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)