mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
remove a few string copies
This commit is contained in:
parent
db5a1a7604
commit
b2d5c24c1d
18 changed files with 39 additions and 80 deletions
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2018 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
nat_set.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Wrapper for sstream.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2013
|
||||
|
||||
Revision History:
|
||||
|
||||
*/
|
||||
#pragma once
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
namespace lean {
|
||||
/** \brief Wrapper for std::ostringstream */
|
||||
class sstream {
|
||||
std::ostringstream m_strm;
|
||||
public:
|
||||
std::string str() const { return m_strm.str(); }
|
||||
template<typename T> sstream & operator<<(T const & t) { m_strm << t; return *this; }
|
||||
};
|
||||
}
|
|
@ -152,7 +152,7 @@ std::string zstring::encode() const {
|
|||
unsigned ch = m_buffer[i];
|
||||
if (ch < 32 || ch >= 128 || ('\\' == ch && i + 1 < m_buffer.size() && 'u' == m_buffer[i+1])) {
|
||||
_flush();
|
||||
strm << "\\u{" << std::hex << ch << std::dec << "}";
|
||||
strm << "\\u{" << std::hex << ch << std::dec << '}';
|
||||
}
|
||||
else {
|
||||
if (offset == 99)
|
||||
|
@ -161,7 +161,7 @@ std::string zstring::encode() const {
|
|||
}
|
||||
}
|
||||
_flush();
|
||||
return strm.str();
|
||||
return std::move(strm).str();
|
||||
}
|
||||
|
||||
bool zstring::suffixof(zstring const& other) const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue