Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from setuptools import setup, find_packages

name = "cubao_headers"
version = "0.0.8"
version = "0.1.0"

pattern = ["*"]

Expand Down
2 changes: 1 addition & 1 deletion include/jsoncons/allocator_holder.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013-2025 Daniel Parker
// Copyright 2013-2026 Daniel Parker
// Distributed under the Boost license, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Expand Down
65 changes: 46 additions & 19 deletions include/jsoncons/allocator_set.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013-2025 Daniel Parker
// Copyright 2013-2026 Daniel Parker
// Distributed under the Boost license, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Expand All @@ -13,17 +13,17 @@

namespace jsoncons {

template <typename Allocator,typename TempAllocator >
template <typename Alloc,typename TempAlloc >
class allocator_set
{
Allocator result_alloc_;
TempAllocator temp_alloc_;
Alloc result_alloc_;
TempAlloc temp_alloc_;
public:
using allocator_type = Allocator;
using temp_allocator_type = TempAllocator;
using allocator_type = Alloc;
using temp_allocator_type = TempAlloc;

allocator_set(const Allocator& alloc=Allocator(),
const TempAllocator& temp_alloc=TempAllocator())
allocator_set(const Alloc& alloc=Alloc(),
const TempAlloc& temp_alloc=TempAlloc())
: result_alloc_(alloc), temp_alloc_(temp_alloc)
{
}
Expand All @@ -34,32 +34,59 @@ class allocator_set
allocator_set& operator=(allocator_set&&) = delete;
~allocator_set() = default;

Allocator get_allocator() const {return result_alloc_;}
TempAllocator get_temp_allocator() const {return temp_alloc_;}
Alloc get_allocator() const {return result_alloc_;}
TempAlloc get_temp_allocator() const {return temp_alloc_;}
};

#if !defined(JSONCONS_NO_DEPRECATED)

inline
allocator_set<std::allocator<char>,std::allocator<char>> combine_allocators()
{
return allocator_set<std::allocator<char>,std::allocator<char>>(std::allocator<char>(), std::allocator<char>());
}

template <typename Allocator>
allocator_set<Allocator,std::allocator<char>> combine_allocators(const Allocator& alloc)
template <typename Alloc>
allocator_set<Alloc,std::allocator<char>> combine_allocators(const Alloc& alloc)
{
return allocator_set<Alloc,std::allocator<char>>(alloc, std::allocator<char>());
}

template <typename Alloc,typename TempAlloc >
allocator_set<Alloc,TempAlloc> combine_allocators(const Alloc& alloc, const TempAlloc& temp_alloc)
{
return allocator_set<Alloc,TempAlloc>(alloc, temp_alloc);
}

template <typename TempAlloc >
allocator_set<std::allocator<char>,TempAlloc> temp_allocator_only(const TempAlloc& temp_alloc)
{
return allocator_set<std::allocator<char>,TempAlloc>(std::allocator<char>(), temp_alloc);
}
#endif // !defined(JSONCONS_NO_DEPRECATED)

inline
allocator_set<std::allocator<char>,std::allocator<char>> make_alloc_set()
{
return allocator_set<std::allocator<char>,std::allocator<char>>(std::allocator<char>(), std::allocator<char>());
}

template <typename Alloc>
allocator_set<Alloc,std::allocator<char>> make_alloc_set(const Alloc& alloc)
{
return allocator_set<Allocator,std::allocator<char>>(alloc, std::allocator<char>());
return allocator_set<Alloc,std::allocator<char>>(alloc, std::allocator<char>());
}

template <typename Allocator,typename TempAllocator >
allocator_set<Allocator,TempAllocator> combine_allocators(const Allocator& alloc, const TempAllocator& temp_alloc)
template <typename Alloc,typename TempAlloc >
allocator_set<Alloc,TempAlloc> make_alloc_set(const Alloc& alloc, const TempAlloc& temp_alloc)
{
return allocator_set<Allocator,TempAllocator>(alloc, temp_alloc);
return allocator_set<Alloc,TempAlloc>(alloc, temp_alloc);
}

template <typename TempAllocator >
allocator_set<std::allocator<char>,TempAllocator> temp_allocator_only(const TempAllocator& temp_alloc)
template <typename TempAlloc >
allocator_set<std::allocator<char>,TempAlloc> make_alloc_set(temp_alloc_arg_t, const TempAlloc& temp_alloc)
{
return allocator_set<std::allocator<char>,TempAllocator>(std::allocator<char>(), temp_alloc);
return allocator_set<std::allocator<char>,TempAlloc>(std::allocator<char>(), temp_alloc);
}

} // namespace jsoncons
Expand Down
Loading
Loading