aboutsummaryrefslogtreecommitdiff
path: root/gcc/range-op-float.cc
diff options
context:
space:
mode:
authorWill Hawkins <whh8b@obs.cr>2022-10-19 20:05:59 -0400
committerJonathan Wakely <jwakely@redhat.com>2022-11-08 17:35:14 +0000
commitc93baa93df2d454f329a38686affcfe1a1339766 (patch)
tree7286e8a2461912156a1e524152ae9de8ea8547bf /gcc/range-op-float.cc
parent564b11184650a494d97d9e89b984664ae142a24a (diff)
downloadgcc-c93baa93df2d454f329a38686affcfe1a1339766.zip
gcc-c93baa93df2d454f329a38686affcfe1a1339766.tar.gz
gcc-c93baa93df2d454f329a38686affcfe1a1339766.tar.bz2
libstdc++: Refactor implementation of operator+ for std::string
Until now operator+(char*, string) and operator+(string, char*) had different performance characteristics. The former required a single memory allocation and the latter required two. This patch makes the performance equal. After consultation with Jonathan, it seemed like a good idea to create a single function that performed one-allocation string concatenation that could be used by various different version of operator+. This patch adds such a function and calls it from the relevant implementations. Co-authored-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/basic_string.h (__str_cat): Add common function that performs single-allocation string concatenation. (operator+): Use __str_cat. * include/bits/basic_string.tcc (operator+): Move to .h and define inline using __str_cat. Signed-off-by: Will Hawkins <whh8b@obs.cr>
Diffstat (limited to 'gcc/range-op-float.cc')
0 files changed, 0 insertions, 0 deletions