mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-27 11:21:02 +08:00
rm unique_ptr<>/shared_ptr<>, for pre-C++11
This commit is contained in:
parent
ea2d167a38
commit
dee4602b8f
@ -34,6 +34,12 @@
|
||||
|
||||
namespace Json {
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
typedef std::unique_ptr<StreamWriter> StreamWriterPtr;
|
||||
#else
|
||||
typedef std::auto_ptr<StreamWriter> StreamWriterPtr;
|
||||
#endif
|
||||
|
||||
static bool containsControlCharacter(const char* str) {
|
||||
while (*str) {
|
||||
if (isControlCharacter(*(str++)))
|
||||
@ -1017,14 +1023,14 @@ StreamWriter* OldCompressingStreamWriterBuilder::newStreamWriter(
|
||||
|
||||
std::string writeString(Value const& root, StreamWriter::Factory const& builder) {
|
||||
std::ostringstream sout;
|
||||
std::unique_ptr<StreamWriter> const sw(builder.newStreamWriter(&sout));
|
||||
StreamWriterPtr const sw(builder.newStreamWriter(&sout));
|
||||
sw->write(root);
|
||||
return sout.str();
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& sout, Value const& root) {
|
||||
StreamWriterBuilder builder;
|
||||
std::shared_ptr<StreamWriter> writer(builder.newStreamWriter(&sout));
|
||||
StreamWriterPtr const writer(builder.newStreamWriter(&sout));
|
||||
writer->write(root);
|
||||
return sout;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user