Fix regression reported in #23 (#24)

* Add test from issue 23. Refs #23.
* Fix ptr_vector regression with incomplete types. Refs #23.
* Enable CI for feature branches
This commit is contained in:
Peter Dimov
2019-07-05 07:14:25 -07:00
committed by James E. King III
parent cf42361a92
commit ea3fa755a1
3 changed files with 39 additions and 7 deletions

View File

@@ -19,6 +19,8 @@
#include <vector>
#include <boost/ptr_container/ptr_sequence_adapter.hpp>
#include <boost/ptr_container/detail/ptr_container_disable_deprecated.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/if.hpp>
#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
#pragma GCC diagnostic push
@@ -32,16 +34,27 @@ namespace boost
<
class T,
class CloneAllocator = heap_clone_allocator,
class Allocator = std::allocator<typename ptr_container_detail::void_ptr<T>::type>
class Allocator = void
>
class ptr_vector : public
ptr_sequence_adapter< T, std::vector<
typename ptr_container_detail::void_ptr<T>::type,Allocator>,
CloneAllocator >
ptr_sequence_adapter< T,
std::vector<
typename ptr_container_detail::void_ptr<T>::type,
typename boost::mpl::if_<boost::is_same<Allocator, void>,
std::allocator<typename ptr_container_detail::void_ptr<T>::type>, Allocator>::type
>,
CloneAllocator >
{
typedef ptr_sequence_adapter< T, std::vector<
typename ptr_container_detail::void_ptr<T>::type,Allocator>,
CloneAllocator >
typedef
ptr_sequence_adapter< T,
std::vector<
typename ptr_container_detail::void_ptr<T>::type,
typename boost::mpl::if_<boost::is_same<Allocator, void>,
std::allocator<typename ptr_container_detail::void_ptr<T>::type>, Allocator>::type
>,
CloneAllocator >
base_class;
typedef ptr_vector<T,CloneAllocator,Allocator> this_type;

View File

@@ -43,4 +43,5 @@ test-suite ptr_container :
[ compile const_element_containers.cpp ]
# [ sc-test null_filter_iterator ]
[ compile issue_23.cpp ]
;

18
test/issue_23.cpp Normal file
View File

@@ -0,0 +1,18 @@
// Use, modification and distribution is subject to the
// Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/ptr_container/ptr_vector.hpp>
template<class T> struct Foo
{
static void test(boost::ptr_vector<Foo<T> >& /*t*/)
{
}
};
int main()
{
boost::ptr_vector<Foo<double> > ptr;
return 0;
}