Skip to content

Commit

Permalink
Merge pull request #650 from olegendo/develop
Browse files Browse the repository at this point in the history
Don't include <iostream>, use std::make_shared
  • Loading branch information
nlohmann authored Jul 9, 2017
2 parents 1b2fabe + e3bb156 commit a0e0579
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ SOFTWARE.
#include <functional> // function, hash, less
#include <initializer_list> // initializer_list
#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 <limits> // numeric_limits
#include <locale> // locale
Expand Down Expand Up @@ -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);
}
};

Expand Down Expand Up @@ -6675,7 +6675,7 @@ class basic_json
std::vector<CharType>& v;
};

/// putput adapter for output streams
/// output adapter for output streams
template<typename CharType>
class output_stream_adapter : public output_adapter<CharType>
{
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/src/unit-readme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ using nlohmann::json;
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <iostream>

TEST_CASE("README", "[hide]")
{
Expand Down
1 change: 1 addition & 0 deletions test/src/unit-unicode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SOFTWARE.
using nlohmann::json;

#include <fstream>
#include <iostream>

extern size_t calls;
size_t calls = 0;
Expand Down

0 comments on commit a0e0579

Please sign in to comment.