Skip to content

Commit

Permalink
Fix regression reported in boostorg#23 (boostorg#24)
Browse files Browse the repository at this point in the history
* Add test from issue 23. Refs boostorg#23.
* Fix ptr_vector regression with incomplete types. Refs boostorg#23.
* Enable CI for feature branches
  • Loading branch information
pdimov authored and jeking3 committed Jul 5, 2019
1 parent cf42361 commit ea3fa75
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
27 changes: 20 additions & 7 deletions include/boost/ptr_container/ptr_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ test-suite ptr_container :
[ compile const_element_containers.cpp ]
# [ sc-test null_filter_iterator ]

[ compile issue_23.cpp ]
;
18 changes: 18 additions & 0 deletions test/issue_23.cpp
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit ea3fa75

Please sign in to comment.