forked from boostorg/container
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
|
# pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <boost/container/detail/config_begin.hpp>
|
||||||
|
#include <boost/container/detail/workaround.hpp>
|
||||||
|
|
||||||
// container
|
// container
|
||||||
#include <boost/container/throw_exception.hpp>
|
#include <boost/container/throw_exception.hpp>
|
||||||
// container/detail
|
// container/detail
|
||||||
@@ -71,7 +74,20 @@ struct growth_factor_100
|
|||||||
: dtl::grow_factor_ratio<0, 2, 1>
|
: 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 container {
|
||||||
} //namespace boost {
|
} //namespace boost {
|
||||||
|
|
||||||
|
#include <boost/container/detail/config_end.hpp>
|
||||||
|
|
||||||
#endif //#ifndef BOOST_CONTAINER_DETAIL_NEXT_CAPACITY_HPP
|
#endif //#ifndef BOOST_CONTAINER_DETAIL_NEXT_CAPACITY_HPP
|
||||||
|
Reference in New Issue
Block a user