diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-08-23 12:21:46 +0200 |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-08-23 18:52:33 +0200 |
commit | 3b2b02825d88a045d08b8295927652cbcff408a8 (patch) | |
tree | 576d53beef55b9da82fe7e22187efb023c12d59d /Source/cmTimestamp.cxx | |
parent | 19612dffd27d90d73e3b7cff9cbba241294c17e9 (diff) | |
download | cmake-3b2b02825d88a045d08b8295927652cbcff408a8.tar.gz |
Source sweep: Replace std::ostringstream when used with a single append
This replaces `std::ostringstream`, when it is written to only once.
If the single written argument was numeric, `std::to_string` is used instead.
Otherwise, the single written argument is used directly instead of the
`std::ostringstream::str()` invocation.
Diffstat (limited to 'Source/cmTimestamp.cxx')
-rw-r--r-- | Source/cmTimestamp.cxx | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index 9e3222613a..a9be729e77 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -168,9 +168,7 @@ std::string cmTimestamp::AddTimestampComponent(char flag, return std::string(); } - std::ostringstream ss; - ss << static_cast<long int>(difftime(timeT, unixEpoch)); - return ss.str(); + return std::to_string(static_cast<long int>(difftime(timeT, unixEpoch))); } default: { return formatString; |