use std::make_shared

This commit is contained in:
Oleg Endo 2017-07-09 15:19:08 +09:00
parent f0ca96d462
commit b753cb6ee7

View file

@ -6634,17 +6634,17 @@ class basic_json
static std::shared_ptr<output_adapter<CharType>> create(std::vector<CharType>& vec)
{
return std::shared_ptr<output_adapter>(new output_vector_adapter<CharType>(vec));
return std::make_shared<output_vector_adapter<CharType>>(vec);
}
static std::shared_ptr<output_adapter<CharType>> create(std::ostream& s)
{
return std::shared_ptr<output_adapter>(new output_stream_adapter<CharType>(s));
return std::make_shared<output_stream_adapter<CharType>>(s);
}
static std::shared_ptr<output_adapter<CharType>> create(std::string& s)
{
return std::shared_ptr<output_adapter>(new output_string_adapter<CharType>(s));
return std::make_shared<output_string_adapter<CharType>>(s);
}
};
@ -8767,19 +8767,19 @@ class basic_json
/// input adapter for input stream
static std::shared_ptr<input_adapter> create(std::istream& i)
{
return std::shared_ptr<input_adapter>(new cached_input_stream_adapter<16384>(i));
return std::make_shared<cached_input_stream_adapter<16384>> (i);
}
/// input adapter for input stream
static std::shared_ptr<input_adapter> create(std::istream&& i)
{
return std::shared_ptr<input_adapter>(new cached_input_stream_adapter<16384>(i));
return std::make_shared<cached_input_stream_adapter<16384>>(i);
}
/// input adapter for buffer
static std::shared_ptr<input_adapter> create(const char* b, size_t l)
{
return std::shared_ptr<input_adapter>(new input_buffer_adapter(b, l));
return std::make_shared<input_buffer_adapter>(b, l);
}
// derived support