1
0
forked from boostorg/core

Add detection support for single argument construct and destroy

This commit is contained in:
Glen Fernandes
2022-03-12 01:06:00 -05:00
parent f326683d42
commit c4deb479fd
3 changed files with 106 additions and 49 deletions

View File

@ -26,6 +26,16 @@ struct A2 {
};
#endif
template<class T>
struct A3 {
typedef T value_type;
A3() { }
template<class U>
void construct(U* p) {
::new((void*)p) U(1);
}
};
int main()
{
{
@ -42,5 +52,11 @@ int main()
BOOST_TEST_EQ(i, 6);
}
#endif
{
A3<int> a;
int i = 0;
boost::allocator_construct(a, &i);
BOOST_TEST_EQ(i, 1);
}
return boost::report_errors();
}

View File

@ -29,7 +29,6 @@ struct A1 {
A1() { }
};
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
template<class T>
struct A2 {
typedef T value_type;
@ -39,7 +38,6 @@ struct A2 {
*p = U();
}
};
#endif
int main()
{
@ -50,13 +48,11 @@ int main()
BOOST_TEST_EQ(S::count, 0);
::new((void*)&s) S();
}
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
{
A2<int> a;
int i = 5;
boost::allocator_destroy(a, &i);
BOOST_TEST_EQ(i, 0);
}
#endif
return boost::report_errors();
}