mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-30 20:57:21 +02:00
Add get_deleter test with an incomplete class
This commit is contained in:
@ -218,6 +218,8 @@ import testing ;
|
|||||||
|
|
||||||
[ run atomic_sp_constexpr_test.cpp ]
|
[ run atomic_sp_constexpr_test.cpp ]
|
||||||
|
|
||||||
|
[ run get_deleter_test2.cpp ]
|
||||||
|
|
||||||
[ run local_sp_test.cpp ]
|
[ run local_sp_test.cpp ]
|
||||||
[ run lsp_array_test.cpp ]
|
[ run lsp_array_test.cpp ]
|
||||||
[ run lsp_array_n_test.cpp ]
|
[ run lsp_array_n_test.cpp ]
|
||||||
|
37
test/get_deleter_test2.cpp
Normal file
37
test/get_deleter_test2.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
//
|
||||||
|
// get_deleter_test2.cpp
|
||||||
|
//
|
||||||
|
// Copyright 2017 Peter Dimov
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0. (See
|
||||||
|
// accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
|
struct deleter;
|
||||||
|
|
||||||
|
struct X
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
static void test_get_deleter( boost::shared_ptr<X> const & p )
|
||||||
|
{
|
||||||
|
BOOST_TEST( boost::get_deleter<deleter>( p ) != 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
struct deleter
|
||||||
|
{
|
||||||
|
void operator()( X const * p ) { delete p; }
|
||||||
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
boost::shared_ptr<X> p( new X, deleter() );
|
||||||
|
|
||||||
|
test_get_deleter( p );
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
Reference in New Issue
Block a user