Fix -Wcast-qual warnings.

This commit is contained in:
Ion Gaztañaga
2025-11-02 23:01:14 +01:00
parent 7ba8bae1be
commit 1ef175aa91
2 changed files with 3 additions and 3 deletions

View File

@@ -91,7 +91,7 @@ namespace dtl {
template<class T, class ...Args>
BOOST_CONTAINER_FORCEINLINE void construct_type(T *p, BOOST_FWD_REF(Args) ...args)
{
::new((void*)p, boost_container_new_t()) T(::boost::forward<Args>(args)...);
::new(const_cast<void*>(static_cast<const volatile void*>(p)), boost_container_new_t()) T(::boost::forward<Args>(args)...);
}
#else
@@ -102,7 +102,7 @@ BOOST_CONTAINER_FORCEINLINE \
typename dtl::disable_if_c<dtl::is_pair<T>::value, void >::type \
construct_type(T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
{\
::new((void*)p, boost_container_new_t()) T( BOOST_MOVE_FWD##N );\
::new(const_cast<void*>(static_cast<const volatile void*>(p)), boost_container_new_t()) T( BOOST_MOVE_FWD##N );\
}\
//
BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_TYPEJ)

View File

@@ -274,7 +274,7 @@ class basic_string_base
//active representation is short or long
short_header hdr;
BOOST_CONTAINER_STATIC_ASSERT((sizeof(short_header) == 1));
*(unsigned char*)&hdr = *(unsigned char*)&this->members_.m_repr;
*(unsigned char*)&hdr = *static_cast<const unsigned char*>(static_cast<const void *>(&this->members_.m_repr));
return hdr.is_short != 0;
}