mirror of
https://github.com/nlohmann/json.git
synced 2024-08-23 05:22:28 +02:00
use std::make_shared
This commit is contained in:
parent
f0ca96d462
commit
b753cb6ee7
12
src/json.hpp
12
src/json.hpp
|
@ -6634,17 +6634,17 @@ class basic_json
|
||||||
|
|
||||||
static std::shared_ptr<output_adapter<CharType>> create(std::vector<CharType>& vec)
|
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)
|
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)
|
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
|
/// input adapter for input stream
|
||||||
static std::shared_ptr<input_adapter> create(std::istream& i)
|
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
|
/// input adapter for input stream
|
||||||
static std::shared_ptr<input_adapter> create(std::istream&& i)
|
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
|
/// input adapter for buffer
|
||||||
static std::shared_ptr<input_adapter> create(const char* b, size_t l)
|
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
|
// derived support
|
||||||
|
|
Loading…
Reference in a new issue