forked from boostorg/smart_ptr
Do not use components removed in C++17 (auto_ptr, binary_function)
This commit is contained in:
1 parent
bdc19dee01
commit
a7fbb0a841
6 files changed
+48
-34
No files matched your search
@@ -1,3 +1,5 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
//
|
||||
// auto_ptr_rv_test.cpp
|
||||
//
|
||||
@@ -8,6 +10,14 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
|
||||
#if defined( BOOST_NO_AUTO_PTR )
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <memory>
|
||||
@@ -109,3 +119,5 @@ int main()
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#endif // #if defined( BOOST_NO_AUTO_PTR )
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
@@ -77,11 +78,15 @@ void test()
|
||||
|
||||
BOOST_TEST( X::instances == 0 );
|
||||
|
||||
#if !defined( BOOST_NO_AUTO_PTR )
|
||||
|
||||
{
|
||||
std::auto_ptr<X> px( new X( 0 ) );
|
||||
BOOST_TEST( X::instances == 1 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
BOOST_TEST( X::instances == 0 );
|
||||
|
||||
{
|
||||
|
||||
@@ -16,8 +16,11 @@
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
template<class T, class U> void assert_same_type( T** pt = 0, U** pu = 0 )
|
||||
{
|
||||
pt = pu;
|
||||
@@ -58,12 +61,16 @@ int main()
|
||||
assert_same_type< boost::pointer_to_other< boost::intrusive_ptr<X>, void >::type, boost::intrusive_ptr<void> >();
|
||||
assert_same_type< boost::pointer_to_other< boost::intrusive_ptr<void>, Y >::type, boost::intrusive_ptr<Y> >();
|
||||
|
||||
#if !defined( BOOST_NO_AUTO_PTR )
|
||||
|
||||
// auto_ptr
|
||||
|
||||
assert_same_type< boost::pointer_to_other< std::auto_ptr<X>, Y >::type, std::auto_ptr<Y> >();
|
||||
assert_same_type< boost::pointer_to_other< std::auto_ptr<X>, void >::type, std::auto_ptr<void> >();
|
||||
assert_same_type< boost::pointer_to_other< std::auto_ptr<void>, Y >::type, std::auto_ptr<Y> >();
|
||||
|
||||
#endif
|
||||
|
||||
// raw pointer
|
||||
|
||||
assert_same_type< boost::pointer_to_other< X *, Y >::type, Y * >();
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
@@ -75,11 +76,15 @@ void test()
|
||||
|
||||
BOOST_TEST( X::instances == 0 );
|
||||
|
||||
#if !defined( BOOST_NO_AUTO_PTR )
|
||||
|
||||
{
|
||||
std::auto_ptr<X> px( new X( 0 ) );
|
||||
BOOST_TEST( X::instances == 1 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
BOOST_TEST( X::instances == 0 );
|
||||
|
||||
{
|
||||
|
||||
@@ -850,6 +850,8 @@ void weak_ptr_constructor()
|
||||
|
||||
void auto_ptr_constructor()
|
||||
{
|
||||
#if !defined( BOOST_NO_AUTO_PTR )
|
||||
|
||||
{
|
||||
std::auto_ptr<int> p;
|
||||
boost::shared_ptr<int> pi(p);
|
||||
@@ -1136,6 +1138,8 @@ void auto_ptr_constructor()
|
||||
|
||||
BOOST_TEST(X::instances == 0);
|
||||
BOOST_TEST(Y::instances == 0);
|
||||
|
||||
#endif // #if !defined( BOOST_NO_AUTO_PTR )
|
||||
}
|
||||
|
||||
void test()
|
||||
@@ -1420,6 +1424,8 @@ void conversion_assignment()
|
||||
|
||||
void auto_ptr_assignment()
|
||||
{
|
||||
#if !defined( BOOST_NO_AUTO_PTR )
|
||||
|
||||
{
|
||||
boost::shared_ptr<int> p1;
|
||||
|
||||
@@ -1516,6 +1522,8 @@ void auto_ptr_assignment()
|
||||
BOOST_TEST(X::instances == 0);
|
||||
BOOST_TEST(Y::instances == 0);
|
||||
}
|
||||
|
||||
#endif // #if !defined( BOOST_NO_AUTO_PTR )
|
||||
}
|
||||
|
||||
void test()
|
||||
|
||||
Reference in new issue
Block a user