From: Rob Stewart (rstewart_at_[hidden])
Date: 2019-12-07 18:23:51
On December 5, 2019 9:35:35 AM EST, Phil Endecott via Boost <boost_at_[hidden]> wrote:
> Peter Dimov wrote:
> > - a function that checks whether the remaining capacity is at least
> n should
> > be added. I suggest the name
> > bool can_fit( std::size_t n ) const noexcept;
> > although my previous choice of "has_capacity_for" has merit too.
I suggest the simpler "fits".
> Make this a free function template and you can use it with other
> template <typename CONTAINER>
> bool can_fit( const CONTAINER& C, typename CONTAINER::size_type n )
> return C.capacity() - C.size() >= n;
That's a nice idea, especially with the name "fits". :) However, if you reverse the parameters, "fits_in" would be a better name as it indicates the argument order.
-- Rob (Sent from my portable computation device.)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk