Update foa to be gcc-4.8 compliant

This commit is contained in:
Christian Mazakas
2023-09-28 08:31:14 -07:00
parent b482890453
commit 9bc7876583
3 changed files with 29 additions and 10 deletions

View File

@ -126,7 +126,7 @@ template<typename Mutex>
class shared_lock class shared_lock
{ {
public: public:
shared_lock(Mutex& m_)noexcept:m{m_}{m.lock_shared();} shared_lock(Mutex& m_)noexcept:m(m_){m.lock_shared();}
~shared_lock()noexcept{if(owns)m.unlock_shared();} ~shared_lock()noexcept{if(owns)m.unlock_shared();}
/* not used but VS in pre-C++17 mode needs to see it for RVO */ /* not used but VS in pre-C++17 mode needs to see it for RVO */
@ -148,7 +148,7 @@ template<typename Mutex>
class lock_guard class lock_guard
{ {
public: public:
lock_guard(Mutex& m_)noexcept:m{m_}{m.lock();} lock_guard(Mutex& m_)noexcept:m(m_){m.lock();}
~lock_guard()noexcept{m.unlock();} ~lock_guard()noexcept{m.unlock();}
/* not used but VS in pre-C++17 mode needs to see it for RVO */ /* not used but VS in pre-C++17 mode needs to see it for RVO */
@ -1029,7 +1029,7 @@ private:
erase_on_exit( erase_on_exit(
concurrent_table& x_, concurrent_table& x_,
group_type* pg_,unsigned int pos_,element_type* p_): group_type* pg_,unsigned int pos_,element_type* p_):
x{x_},pg{pg_},pos{pos_},p{p_}{} x(x_),pg(pg_),pos(pos_),p(p_){}
~erase_on_exit(){if(!rollback_)x.super::erase(pg,pos,p);} ~erase_on_exit(){if(!rollback_)x.super::erase(pg,pos,p);}
void rollback(){rollback_=true;} void rollback(){rollback_=true;}
@ -1283,7 +1283,7 @@ private:
struct reserve_size struct reserve_size
{ {
reserve_size(concurrent_table& x_):x{x_} reserve_size(concurrent_table& x_):x(x_)
{ {
size_=++x.size_ctrl.size; size_=++x.size_ctrl.size;
} }

View File

@ -1043,7 +1043,13 @@ struct table_arrays
initialize_groups( initialize_groups(
arrays.groups(),groups_size, arrays.groups(),groups_size,
std::integral_constant< std::integral_constant<
bool,std::is_trivially_constructible<group_type>::value bool,
#if BOOST_WORKAROUND(BOOST_LIBSTDCXX_VERSION,<50000)
/* std::is_trivially_default_constructible not provided */
std::has_trivial_default_constructor<group_type>::value
#else
std::is_trivially_default_constructible<group_type>::value
#endif
>{}); >{});
arrays.groups()[groups_size-1].set_sentinel(); arrays.groups()[groups_size-1].set_sentinel();
} }
@ -2016,7 +2022,14 @@ private:
copy_elements_array_from( copy_elements_array_from(
x, x,
std::integral_constant< std::integral_constant<
bool,std::is_trivially_copy_constructible<element_type>::value bool,
#if BOOST_WORKAROUND(BOOST_LIBSTDCXX_VERSION,<50000)
/* std::is_trivially_copy_constructible not provided */
std::is_copy_constructible<element_type>::value&&
std::has_trivial_copy_constructor<element_type>::value
#else
std::is_trivially_copy_constructible<element_type>::value
#endif
&&( &&(
is_std_allocator<Allocator>::value|| is_std_allocator<Allocator>::value||
!alloc_has_construct<Allocator,value_type*,const value_type&>::value) !alloc_has_construct<Allocator,value_type*,const value_type&>::value)
@ -2060,7 +2073,13 @@ private:
void copy_groups_array_from(const table_core& x) { void copy_groups_array_from(const table_core& x) {
copy_groups_array_from(x, std::integral_constant<bool, copy_groups_array_from(x, std::integral_constant<bool,
#if BOOST_WORKAROUND(BOOST_LIBSTDCXX_VERSION,<50000)
/* std::is_trivially_copy_assignable not provided */
std::is_copy_assignable<group_type>::value&&
std::has_trivial_copy_assign<group_type>::value
#else
std::is_trivially_copy_assignable<group_type>::value std::is_trivially_copy_assignable<group_type>::value
#endif
>{} >{}
); );
} }

View File

@ -106,7 +106,7 @@ public:
using element_type= using element_type=
typename std::conditional<Const,value_type const,value_type>::type; typename std::conditional<Const,value_type const,value_type>::type;
table_iterator()=default; table_iterator():pc_{nullptr},p_{nullptr}{};
template<bool Const2,typename std::enable_if<!Const2>::type* =nullptr> template<bool Const2,typename std::enable_if<!Const2>::type* =nullptr>
table_iterator(const table_iterator<TypePolicy,GroupPtr,Const2>& x): table_iterator(const table_iterator<TypePolicy,GroupPtr,Const2>& x):
pc_{x.pc_},p_{x.p_}{} pc_{x.pc_},p_{x.p_}{}
@ -133,10 +133,10 @@ private:
template<typename> friend class table_erase_return_type; template<typename> friend class table_erase_return_type;
template<typename,typename,typename,typename> friend class table; template<typename,typename,typename,typename> friend class table;
table_iterator(group_type* pg,std::size_t n,const table_element_type* p): table_iterator(group_type* pg,std::size_t n,const table_element_type* ptet):
pc_{to_pointer<char_pointer>( pc_{to_pointer<char_pointer>(
reinterpret_cast<unsigned char*>(const_cast<group_type*>(pg))+n)}, reinterpret_cast<unsigned char*>(const_cast<group_type*>(pg))+n)},
p_{to_pointer<table_element_pointer>(const_cast<table_element_type*>(p))} p_{to_pointer<table_element_pointer>(const_cast<table_element_type*>(ptet))}
{} {}
unsigned char* pc()const noexcept{return boost::to_address(pc_);} unsigned char* pc()const noexcept{return boost::to_address(pc_);}
@ -568,7 +568,7 @@ private:
struct erase_on_exit struct erase_on_exit
{ {
erase_on_exit(table& x_,const_iterator it_):x{x_},it{it_}{} erase_on_exit(table& x_,const_iterator it_):x(x_),it(it_){}
~erase_on_exit(){if(!rollback_)x.erase(it);} ~erase_on_exit(){if(!rollback_)x.erase(it);}
void rollback(){rollback_=true;} void rollback(){rollback_=true;}