C++ Logo


Advanced search

Re: [SG14] sizeof_block_metadata function, colony/hive, advice wanted

From: Matt Bentley <mattreecebentley_at_[hidden]>
Date: Thu, 25 Nov 2021 21:51:52 +1300
Hi Paul,
it'd throw because returning a value matching an inaccurate input value
might lead to the user expecting that they could reasonably manually
specify a min/max block capacity in colony/hive that they can't. But
you're right it should be const.
I don't think it's unreasonable to add it now, it's basically a 5-line
function, my main question is whether or not people would find it useful.

On 25/11/2021 9:11 pm, Paul M. Bendixen wrote:
> Hi
> I'm curious as to why you would want to have a function that is only
> inspecting a container throw? (and not be const).
> I can follow your reasoning why you would want it, but is it something
> that could be added later without breaking ABI (which seems to be the
> most important thing in the world right now)?
> If so, maybe it could be another paper that would perhaps be easier to
> get in on its own.
> Best
> Paul
> tor. 25. nov. 2021 02.35 skrev Matt Bentley via SG14
> <sg14_at_[hidden] <mailto:sg14_at_[hidden]>>:
> Hi all,
> thinking about including a
> size_type sizeof_block_metadata(const size_t block_size)
> function for colony/hive, as this would allow the user to ascertain the
> amount of memory used by a memory block's metadata in colony (including
> skipfield), given the number of elements stored in that memory block.
> This is less important for colony which is a fixed implementation, more
> important for std::hive which could potentially have many alternative
> implementations and these might not be visible to the user in text form.
> The idea was that if someone knows how much memory is used by each
> block
> outside of the actual memory used to store the elements, that might aid
> in terms of knowing how much cache space is used by the metadata and
> people might be able to make better decisions about the min/max
> capacities of memory blocks (if they are specifying these manually) on
> that basis.
> The function would throw an exception if the block_size specified was
> outside the minimum/maximum block capacity ranges.
> My main question to you is whether this function is worth including
> - as
> it adds yet another function to the codebase.
> Thanks,
> M@
> _______________________________________________
> SG14 mailing list
> SG14_at_[hidden] <mailto:SG14_at_[hidden]>
> https://lists.isocpp.org/mailman/listinfo.cgi/sg14
> <https://lists.isocpp.org/mailman/listinfo.cgi/sg14>

Received on 2021-11-25 02:51:59