-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update to jsoncons to bbaf3b73b (0.172.1 + additional commits)
- Loading branch information
Showing
143 changed files
with
14,812 additions
and
9,387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright 2013-2023 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) | ||
|
||
// See https://github.com/danielaparker/jsoncons for latest version | ||
|
||
#ifndef JSONCONS_ALLOCATOR_STRATEGY_HPP | ||
#define JSONCONS_ALLOCATOR_STRATEGY_HPP | ||
|
||
#include <memory> | ||
#include <jsoncons/tag_type.hpp> | ||
|
||
namespace jsoncons { | ||
|
||
template <class Allocator,class TempAllocator> | ||
class allocator_set | ||
{ | ||
Allocator result_alloc_; | ||
TempAllocator temp_alloc_; | ||
public: | ||
using allocator_type = Allocator; | ||
using temp_allocator_type = TempAllocator; | ||
|
||
allocator_set(const Allocator& alloc=Allocator(), | ||
const TempAllocator& temp_alloc=TempAllocator()) | ||
: result_alloc_(alloc), temp_alloc_(temp_alloc) | ||
{ | ||
} | ||
|
||
allocator_set(const allocator_set&) = default; | ||
allocator_set(allocator_set&&) = default; | ||
allocator_set& operator=(const allocator_set&) = delete; | ||
allocator_set& operator=(allocator_set&&) = delete; | ||
~allocator_set() = default; | ||
|
||
Allocator get_allocator() const {return result_alloc_;} | ||
TempAllocator get_temp_allocator() const {return temp_alloc_;} | ||
}; | ||
|
||
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 <class Allocator> | ||
allocator_set<Allocator,std::allocator<char>> combine_allocators(const Allocator& alloc) | ||
{ | ||
return allocator_set<Allocator,std::allocator<char>>(alloc, std::allocator<char>()); | ||
} | ||
|
||
template <class Allocator,class TempAllocator> | ||
allocator_set<Allocator,TempAllocator> combine_allocators(const Allocator& alloc, const TempAllocator& temp_alloc) | ||
{ | ||
return allocator_set<Allocator,TempAllocator>(alloc, temp_alloc); | ||
} | ||
|
||
template <class TempAllocator> | ||
allocator_set<std::allocator<char>,TempAllocator> temp_allocator_only(const TempAllocator& temp_alloc) | ||
{ | ||
return allocator_set<std::allocator<char>,TempAllocator>(std::allocator<char>(), temp_alloc); | ||
} | ||
|
||
} // namespace jsoncons | ||
|
||
#endif |
Oops, something went wrong.