Remove uses of BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP

This commit is contained in:
Peter Dimov
2024-09-25 20:26:14 +03:00
parent aa1a9ef2d7
commit 94d31304f3
4 changed files with 0 additions and 115 deletions

View File

@@ -47,8 +47,6 @@ public:
return use_count_; return use_count_;
} }
#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
inline friend void intrusive_ptr_add_ref(base const * p) inline friend void intrusive_ptr_add_ref(base const * p)
{ {
++p->use_count_; ++p->use_count_;
@@ -58,45 +56,12 @@ public:
{ {
if(--p->use_count_ == 0) delete p; if(--p->use_count_ == 0) delete p;
} }
#else
void add_ref() const
{
++use_count_;
}
void release() const
{
if(--use_count_ == 0) delete this;
}
#endif
}; };
long base::instances = 0; long base::instances = 0;
} // namespace N } // namespace N
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
namespace boost
{
inline void intrusive_ptr_add_ref(N::base const * p)
{
p->add_ref();
}
inline void intrusive_ptr_release(N::base const * p)
{
p->release();
}
} // namespace boost
#endif
// //
struct X: public virtual N::base struct X: public virtual N::base

View File

@@ -50,8 +50,6 @@ public:
return use_count_; return use_count_;
} }
#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
inline friend void intrusive_ptr_add_ref(base const * p) inline friend void intrusive_ptr_add_ref(base const * p)
{ {
++p->use_count_; ++p->use_count_;
@@ -61,45 +59,12 @@ public:
{ {
if(--p->use_count_ == 0) delete p; if(--p->use_count_ == 0) delete p;
} }
#else
void add_ref() const
{
++use_count_;
}
void release() const
{
if(--use_count_ == 0) delete this;
}
#endif
}; };
long base::instances = 0; long base::instances = 0;
} // namespace N } // namespace N
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
namespace boost
{
inline void intrusive_ptr_add_ref(N::base const * p)
{
p->add_ref();
}
inline void intrusive_ptr_release(N::base const * p)
{
p->release();
}
} // namespace boost
#endif
// //
struct X: public virtual N::base struct X: public virtual N::base
@@ -170,9 +135,6 @@ void pointer_constructor()
BOOST_TEST( N::base::instances == 1 ); BOOST_TEST( N::base::instances == 1 );
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
using boost::intrusive_ptr_add_ref;
#endif
intrusive_ptr_add_ref(p); intrusive_ptr_add_ref(p);
BOOST_TEST(p->use_count() == 1); BOOST_TEST(p->use_count() == 1);
@@ -581,9 +543,6 @@ void test()
BOOST_TEST( N::base::instances == 1 ); BOOST_TEST( N::base::instances == 1 );
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
using boost::intrusive_ptr_add_ref;
#endif
intrusive_ptr_add_ref( p ); intrusive_ptr_add_ref( p );
BOOST_TEST( p->use_count() == 1 ); BOOST_TEST( p->use_count() == 1 );
@@ -649,9 +608,6 @@ void test()
X * p = new X; X * p = new X;
BOOST_TEST( p->use_count() == 0 ); BOOST_TEST( p->use_count() == 0 );
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
using boost::intrusive_ptr_add_ref;
#endif
intrusive_ptr_add_ref( p ); intrusive_ptr_add_ref( p );
BOOST_TEST( p->use_count() == 1 ); BOOST_TEST( p->use_count() == 1 );
@@ -679,10 +635,6 @@ void test()
BOOST_TEST(px? false: true); BOOST_TEST(px? false: true);
BOOST_TEST(!px); BOOST_TEST(!px);
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
using boost::get_pointer;
#endif
BOOST_TEST(get_pointer(px) == px.get()); BOOST_TEST(get_pointer(px) == px.get());
} }
@@ -691,10 +643,6 @@ void test()
BOOST_TEST(px? false: true); BOOST_TEST(px? false: true);
BOOST_TEST(!px); BOOST_TEST(!px);
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
using boost::get_pointer;
#endif
BOOST_TEST(get_pointer(px) == px.get()); BOOST_TEST(get_pointer(px) == px.get());
} }
@@ -705,10 +653,6 @@ void test()
BOOST_TEST(&*px == px.get()); BOOST_TEST(&*px == px.get());
BOOST_TEST(px.operator ->() == px.get()); BOOST_TEST(px.operator ->() == px.get());
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
using boost::get_pointer;
#endif
BOOST_TEST(get_pointer(px) == px.get()); BOOST_TEST(get_pointer(px) == px.get());
} }

View File

@@ -1979,10 +1979,6 @@ void test()
BOOST_TEST(px? false: true); BOOST_TEST(px? false: true);
BOOST_TEST(!px); BOOST_TEST(!px);
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
using boost::get_pointer;
#endif
BOOST_TEST(get_pointer(px) == px.get()); BOOST_TEST(get_pointer(px) == px.get());
} }
@@ -1992,10 +1988,6 @@ void test()
BOOST_TEST(px? false: true); BOOST_TEST(px? false: true);
BOOST_TEST(!px); BOOST_TEST(!px);
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
using boost::get_pointer;
#endif
BOOST_TEST(get_pointer(px) == px.get()); BOOST_TEST(get_pointer(px) == px.get());
} }
@@ -2005,10 +1997,6 @@ void test()
BOOST_TEST(px? false: true); BOOST_TEST(px? false: true);
BOOST_TEST(!px); BOOST_TEST(!px);
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
using boost::get_pointer;
#endif
BOOST_TEST(get_pointer(px) == px.get()); BOOST_TEST(get_pointer(px) == px.get());
} }
@@ -2021,10 +2009,6 @@ void test()
BOOST_TEST(&*px == px.get()); BOOST_TEST(&*px == px.get());
BOOST_TEST(px.operator ->() == px.get()); BOOST_TEST(px.operator ->() == px.get());
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
using boost::get_pointer;
#endif
BOOST_TEST(get_pointer(px) == px.get()); BOOST_TEST(get_pointer(px) == px.get());
} }
@@ -2037,10 +2021,6 @@ void test()
BOOST_TEST(&*px == px.get()); BOOST_TEST(&*px == px.get());
BOOST_TEST(px.operator ->() == px.get()); BOOST_TEST(px.operator ->() == px.get());
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
using boost::get_pointer;
#endif
BOOST_TEST(get_pointer(px) == px.get()); BOOST_TEST(get_pointer(px) == px.get());
} }
} }

View File

@@ -178,10 +178,6 @@ void test()
BOOST_TEST( cp.use_count() == 3 ); BOOST_TEST( cp.use_count() == 3 );
BOOST_TEST( *cp == 87654 ); BOOST_TEST( *cp == 87654 );
#if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP )
using boost::swap;
#endif
boost::shared_ptr<int> cp4; boost::shared_ptr<int> cp4;
swap( cp2, cp4 ); swap( cp2, cp4 );
BOOST_TEST( cp4.use_count() == 3 ); BOOST_TEST( cp4.use_count() == 3 );