Merge pull request #650 from olegendo/develop

Don't include <iostream>, use std::make_shared
This commit is contained in:
Niels Lohmann 2017-07-09 11:12:46 +02:00 committed by GitHub
commit a0e0579374
3 changed files with 10 additions and 8 deletions

View file

@ -43,7 +43,7 @@ SOFTWARE.
#include <functional> // function, hash, less #include <functional> // function, hash, less
#include <initializer_list> // initializer_list #include <initializer_list> // initializer_list
#include <iomanip> // hex #include <iomanip> // hex
#include <iostream> // istream, ostream #include <iosfwd> // istream, ostream
#include <iterator> // advance, begin, back_inserter, bidirectional_iterator_tag, distance, end, inserter, iterator, iterator_traits, next, random_access_iterator_tag, reverse_iterator #include <iterator> // advance, begin, back_inserter, bidirectional_iterator_tag, distance, end, inserter, iterator, iterator_traits, next, random_access_iterator_tag, reverse_iterator
#include <limits> // numeric_limits #include <limits> // numeric_limits
#include <locale> // locale #include <locale> // locale
@ -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);
} }
}; };
@ -6675,7 +6675,7 @@ class basic_json
std::vector<CharType>& v; std::vector<CharType>& v;
}; };
/// putput adapter for output streams /// output adapter for output streams
template<typename CharType> template<typename CharType>
class output_stream_adapter : public output_adapter<CharType> class output_stream_adapter : public output_adapter<CharType>
{ {
@ -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

View file

@ -36,6 +36,7 @@ using nlohmann::json;
#include <list> #include <list>
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include <iostream>
TEST_CASE("README", "[hide]") TEST_CASE("README", "[hide]")
{ {

View file

@ -33,6 +33,7 @@ SOFTWARE.
using nlohmann::json; using nlohmann::json;
#include <fstream> #include <fstream>
#include <iostream>
extern size_t calls; extern size_t calls;
size_t calls = 0; size_t calls = 0;