♻️ allow allocators for vectors
This commit is contained in:
parent
fd0aa4fb0d
commit
5b93e7640c
@ -37,11 +37,11 @@ template<typename CharType>
|
|||||||
using output_adapter_t = std::shared_ptr<output_adapter_protocol<CharType>>;
|
using output_adapter_t = std::shared_ptr<output_adapter_protocol<CharType>>;
|
||||||
|
|
||||||
/// output adapter for byte vectors
|
/// output adapter for byte vectors
|
||||||
template<typename CharType>
|
template<typename CharType, typename AllocatorType = std::allocator<CharType>>
|
||||||
class output_vector_adapter : public output_adapter_protocol<CharType>
|
class output_vector_adapter : public output_adapter_protocol<CharType>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit output_vector_adapter(std::vector<CharType>& vec) noexcept
|
explicit output_vector_adapter(std::vector<CharType, AllocatorType>& vec) noexcept
|
||||||
: v(vec)
|
: v(vec)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ class output_vector_adapter : public output_adapter_protocol<CharType>
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<CharType>& v;
|
std::vector<CharType, AllocatorType>& v;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef JSON_NO_IO
|
#ifndef JSON_NO_IO
|
||||||
@ -114,8 +114,9 @@ template<typename CharType, typename StringType = std::basic_string<CharType>>
|
|||||||
class output_adapter
|
class output_adapter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
output_adapter(std::vector<CharType>& vec)
|
template<typename AllocatorType = std::allocator<CharType>>
|
||||||
: oa(std::make_shared<output_vector_adapter<CharType>>(vec)) {}
|
output_adapter(std::vector<CharType, AllocatorType>& vec)
|
||||||
|
: oa(std::make_shared<output_vector_adapter<CharType, AllocatorType>>(vec)) {}
|
||||||
|
|
||||||
#ifndef JSON_NO_IO
|
#ifndef JSON_NO_IO
|
||||||
output_adapter(std::basic_ostream<CharType>& s)
|
output_adapter(std::basic_ostream<CharType>& s)
|
||||||
|
|||||||
@ -13485,11 +13485,11 @@ template<typename CharType>
|
|||||||
using output_adapter_t = std::shared_ptr<output_adapter_protocol<CharType>>;
|
using output_adapter_t = std::shared_ptr<output_adapter_protocol<CharType>>;
|
||||||
|
|
||||||
/// output adapter for byte vectors
|
/// output adapter for byte vectors
|
||||||
template<typename CharType>
|
template<typename CharType, typename AllocatorType = std::allocator<CharType>>
|
||||||
class output_vector_adapter : public output_adapter_protocol<CharType>
|
class output_vector_adapter : public output_adapter_protocol<CharType>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit output_vector_adapter(std::vector<CharType>& vec) noexcept
|
explicit output_vector_adapter(std::vector<CharType, AllocatorType>& vec) noexcept
|
||||||
: v(vec)
|
: v(vec)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -13505,7 +13505,7 @@ class output_vector_adapter : public output_adapter_protocol<CharType>
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<CharType>& v;
|
std::vector<CharType, AllocatorType>& v;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef JSON_NO_IO
|
#ifndef JSON_NO_IO
|
||||||
@ -13562,8 +13562,9 @@ template<typename CharType, typename StringType = std::basic_string<CharType>>
|
|||||||
class output_adapter
|
class output_adapter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
output_adapter(std::vector<CharType>& vec)
|
template<typename AllocatorType = std::allocator<CharType>>
|
||||||
: oa(std::make_shared<output_vector_adapter<CharType>>(vec)) {}
|
output_adapter(std::vector<CharType, AllocatorType>& vec)
|
||||||
|
: oa(std::make_shared<output_vector_adapter<CharType, AllocatorType>>(vec)) {}
|
||||||
|
|
||||||
#ifndef JSON_NO_IO
|
#ifndef JSON_NO_IO
|
||||||
output_adapter(std::basic_ostream<CharType>& s)
|
output_adapter(std::basic_ostream<CharType>& s)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user