mirror of
https://github.com/boostorg/container.git
synced 2025-08-03 14:34:27 +02:00
Generalize "clamp_by_stored_size_type" to be able to reuse it in other containers
This commit is contained in:
@@ -18,6 +18,9 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/container/detail/config_begin.hpp>
|
||||
#include <boost/container/detail/workaround.hpp>
|
||||
|
||||
// container
|
||||
#include <boost/container/throw_exception.hpp>
|
||||
// container/detail
|
||||
@@ -71,7 +74,20 @@ struct growth_factor_100
|
||||
: dtl::grow_factor_ratio<0, 2, 1>
|
||||
{};
|
||||
|
||||
template<class SizeType>
|
||||
BOOST_CONTAINER_FORCEINLINE void clamp_by_stored_size_type(SizeType &, SizeType)
|
||||
{}
|
||||
|
||||
template<class SizeType, class SomeStoredSizeType>
|
||||
BOOST_CONTAINER_FORCEINLINE void clamp_by_stored_size_type(SizeType &s, SomeStoredSizeType)
|
||||
{
|
||||
if (s >= SomeStoredSizeType(-1) )
|
||||
s = SomeStoredSizeType(-1);
|
||||
}
|
||||
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#include <boost/container/detail/config_end.hpp>
|
||||
|
||||
#endif //#ifndef BOOST_CONTAINER_DETAIL_NEXT_CAPACITY_HPP
|
||||
|
Reference in New Issue
Block a user