xo-alloc2: + AllocRange aux class, for alloc_range()
This commit is contained in:
parent
30615341e2
commit
0a596294b2
8 changed files with 156 additions and 62 deletions
|
|
@ -7,7 +7,8 @@
|
|||
|
||||
#include "AllocError.hpp"
|
||||
#include "AllocInfo.hpp"
|
||||
#include "AllocIterator.hpp"
|
||||
//#include "AllocIterator.hpp"
|
||||
#include "AllocRange.hpp"
|
||||
#include <xo/facet/obj.hpp>
|
||||
#include <xo/facet/facet_implementation.hpp>
|
||||
#include <xo/facet/typeseq.hpp>
|
||||
|
|
@ -35,7 +36,7 @@ namespace xo {
|
|||
/** object header, if configured **/
|
||||
using header_type = std::uint64_t;
|
||||
/** iterator range. These are forward iterators over allocs **/
|
||||
using range_type = std::pair<obj<AAllocIterator>, obj<AAllocIterator>>;
|
||||
using range_type = AllocRange;
|
||||
///@}
|
||||
|
||||
/*
|
||||
|
|
|
|||
34
include/xo/alloc2/alloc/AllocRange.hpp
Normal file
34
include/xo/alloc2/alloc/AllocRange.hpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/** @file AllocRange.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "AllocIterator.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace mm {
|
||||
/** @class AllocRange
|
||||
* @brief Provide range iteration over an @ref AAllcator
|
||||
*
|
||||
* Return value type for @ref AAllocator::alloc_range
|
||||
**/
|
||||
struct AllocRange {
|
||||
public:
|
||||
using repr_type = std::pair<obj<AAllocIterator>, obj<AAllocIterator>>;
|
||||
|
||||
public:
|
||||
AllocRange() = default;
|
||||
explicit AllocRange(repr_type range) : range_{std::move(range)} {}
|
||||
|
||||
obj<AAllocIterator> begin() const { return range_.first; }
|
||||
obj<AAllocIterator> end() const { return range_.second; }
|
||||
|
||||
/** state: {begin,end} pair of alloc iterators **/
|
||||
repr_type range_;
|
||||
};
|
||||
} /*namsepace mm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end AllocRange.hpp */
|
||||
|
|
@ -31,8 +31,7 @@ namespace xo {
|
|||
*/
|
||||
using size_type = std::size_t;
|
||||
using value_type = std::byte *;
|
||||
using range_type = std::pair<obj<AAllocIterator>,
|
||||
obj<AAllocIterator>>;
|
||||
using range_type = AAllocator::range_type;
|
||||
|
||||
static std::string_view name(const DArena &) noexcept;
|
||||
static size_type reserved(const DArena &) noexcept;
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ namespace xo {
|
|||
struct IAllocator_DX1Collector {
|
||||
using size_type = std::size_t;
|
||||
using value_type = std::byte *;
|
||||
using range_type = std::pair<obj<AAllocIterator>,
|
||||
obj<AAllocIterator>>;
|
||||
using range_type = AAllocator::range_type;
|
||||
|
||||
// todo: available()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue