mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-31 03:47:16 +02:00
Replace usage of rote try-catch with corresponding Boost versions
This commit is contained in:
@ -86,31 +86,26 @@ namespace boost {
|
|||||||
template <class A>
|
template <class A>
|
||||||
static void construct(A& al, element_type* p, element_type const& copy)
|
static void construct(A& al, element_type* p, element_type const& copy)
|
||||||
{
|
{
|
||||||
p->p = boost::to_address(boost::allocator_allocate(al, 1));
|
construct(al, p, *copy.p);
|
||||||
try {
|
|
||||||
boost::allocator_construct(al, p->p, *copy.p);
|
|
||||||
} catch (...) {
|
|
||||||
boost::allocator_deallocate(al,
|
|
||||||
boost::pointer_traits<
|
|
||||||
typename boost::allocator_pointer<A>::type>::pointer_to(*p->p),
|
|
||||||
1);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class A, class... Args>
|
template <class A, class... Args>
|
||||||
static void construct(A& al, element_type* p, Args&&... args)
|
static void construct(A& al, element_type* p, Args&&... args)
|
||||||
{
|
{
|
||||||
p->p = boost::to_address(boost::allocator_allocate(al, 1));
|
p->p = boost::to_address(boost::allocator_allocate(al, 1));
|
||||||
try {
|
BOOST_TRY
|
||||||
|
{
|
||||||
boost::allocator_construct(al, p->p, std::forward<Args>(args)...);
|
boost::allocator_construct(al, p->p, std::forward<Args>(args)...);
|
||||||
} catch (...) {
|
}
|
||||||
|
BOOST_CATCH(...)
|
||||||
|
{
|
||||||
boost::allocator_deallocate(al,
|
boost::allocator_deallocate(al,
|
||||||
boost::pointer_traits<
|
boost::pointer_traits<
|
||||||
typename boost::allocator_pointer<A>::type>::pointer_to(*p->p),
|
typename boost::allocator_pointer<A>::type>::pointer_to(*p->p),
|
||||||
1);
|
1);
|
||||||
throw;
|
BOOST_RETHROW
|
||||||
}
|
}
|
||||||
|
BOOST_CATCH_END
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class A> static void destroy(A& al, element_type* p) noexcept
|
template <class A> static void destroy(A& al, element_type* p) noexcept
|
||||||
|
@ -76,15 +76,19 @@ namespace boost {
|
|||||||
static void construct(A& al, element_type* p, Args&&... args)
|
static void construct(A& al, element_type* p, Args&&... args)
|
||||||
{
|
{
|
||||||
p->p = boost::to_address(boost::allocator_allocate(al, 1));
|
p->p = boost::to_address(boost::allocator_allocate(al, 1));
|
||||||
try {
|
BOOST_TRY
|
||||||
|
{
|
||||||
boost::allocator_construct(al, p->p, std::forward<Args>(args)...);
|
boost::allocator_construct(al, p->p, std::forward<Args>(args)...);
|
||||||
} catch (...) {
|
}
|
||||||
|
BOOST_CATCH(...)
|
||||||
|
{
|
||||||
boost::allocator_deallocate(al,
|
boost::allocator_deallocate(al,
|
||||||
boost::pointer_traits<
|
boost::pointer_traits<
|
||||||
typename boost::allocator_pointer<A>::type>::pointer_to(*p->p),
|
typename boost::allocator_pointer<A>::type>::pointer_to(*p->p),
|
||||||
1);
|
1);
|
||||||
throw;
|
BOOST_RETHROW
|
||||||
}
|
}
|
||||||
|
BOOST_CATCH_END
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class A> static void destroy(A& al, element_type* p) noexcept
|
template <class A> static void destroy(A& al, element_type* p) noexcept
|
||||||
|
Reference in New Issue
Block a user