Fix #105 ("Fix gcc -Wdeprecated-copy")

This commit is contained in:
Ion Gaztañaga
2019-03-05 12:15:42 +01:00
parent 2b3775985e
commit da21340323
5 changed files with 59 additions and 8 deletions

View File

@@ -1252,6 +1252,7 @@ use [*Boost.Container]? There are several reasons for that:
* [@https://github.com/boostorg/container/issues/100 GitHub #100: ['"Compile error on Green Hills: container_detail::flat_tree has no member insert"]].
* [@https://github.com/boostorg/container/pull/103 GitHub #103: ['"Fix deallocating never-allocated storage in vector.merge()"]].
* [@https://github.com/boostorg/container/pull/104 GitHub #104: ['"Fix -Wmissing-noreturn clang warnings"]].
* [@https://github.com/boostorg/container/pull/105 GitHub #105: ['"Fix gcc -Wdeprecated-copy"]].
[endsect]

View File

@@ -127,7 +127,12 @@ class deque_iterator
, value_type&
>::type reference;
static std::size_t s_buffer_size()
class nat;
typedef typename dtl::if_c< IsConst
, deque_iterator<Pointer, false>
, nat>::type nonconst_iterator;
BOOST_CONTAINER_FORCEINLINE static std::size_t s_buffer_size()
{ return deque_buf_size<value_type>::value; }
typedef Pointer val_alloc_ptr;
@@ -154,7 +159,11 @@ class deque_iterator
: m_cur(), m_first(), m_last(), m_node() //Value initialization to achieve "null iterators" (N3644)
{}
deque_iterator(deque_iterator<Pointer, false> const& x) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE deque_iterator(const deque_iterator& x) BOOST_NOEXCEPT_OR_NOTHROW
: m_cur(x.get_cur()), m_first(x.get_first()), m_last(x.get_last()), m_node(x.get_node())
{}
BOOST_CONTAINER_FORCEINLINE deque_iterator(const nonconst_iterator& x) BOOST_NOEXCEPT_OR_NOTHROW
: m_cur(x.get_cur()), m_first(x.get_first()), m_last(x.get_last()), m_node(x.get_node())
{}
@@ -162,7 +171,10 @@ class deque_iterator
: m_cur(cur), m_first(first), m_last(last), m_node(node)
{}
deque_iterator<Pointer, false> unconst() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE deque_iterator& operator=(const deque_iterator& x) BOOST_NOEXCEPT_OR_NOTHROW
{ m_cur = x.get_cur(); m_first = x.get_first(); m_last = x.get_last(); m_node = x.get_node(); return *this; }
BOOST_CONTAINER_FORCEINLINE deque_iterator<Pointer, false> unconst() const BOOST_NOEXCEPT_OR_NOTHROW
{
return deque_iterator<Pointer, false>(this->get_cur(), this->get_first(), this->get_last(), this->get_node());
}

View File

@@ -799,7 +799,16 @@ struct iterator_types<IIterator, false>
template<class IIterator, bool IsConst>
class iterator_from_iiterator
{
typedef typename iterator_types<IIterator, IsConst>::type types_t;
typedef typename iterator_types<IIterator, IsConst>::type types_t;
class nat
{
public:
IIterator get() const
{ return IIterator(); }
};
typedef typename dtl::if_c< IsConst
, iterator_from_iiterator<IIterator, false>
, nat>::type nonconst_iterator;
public:
typedef typename types_t::pointer pointer;
@@ -816,10 +825,17 @@ class iterator_from_iiterator
: m_iit(iit)
{}
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator(iterator_from_iiterator<IIterator, false> const& other) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator(const iterator_from_iiterator& other) BOOST_NOEXCEPT_OR_NOTHROW
: m_iit(other.get())
{}
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator(const nonconst_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW
: m_iit(other.get())
{}
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator& operator=(const iterator_from_iiterator& other) BOOST_NOEXCEPT_OR_NOTHROW
{ m_iit = other.get(); return *this; }
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW
{ ++this->m_iit; return *this; }

View File

@@ -297,6 +297,10 @@ class stable_vector_iterator
>::type pointer;
typedef boost::intrusive::pointer_traits<pointer> ptr_traits;
typedef typename ptr_traits::reference reference;
class nat;
typedef typename dtl::if_c< IsConst
, stable_vector_iterator<Pointer, false>
, nat>::type nonconst_iterator;
private:
typedef typename non_const_ptr_traits::template
@@ -324,11 +328,18 @@ class stable_vector_iterator
: m_pn() //Value initialization to achieve "null iterators" (N3644)
{}
stable_vector_iterator(stable_vector_iterator<Pointer, false> const& other) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE stable_vector_iterator(const stable_vector_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW
: m_pn(other.node_pointer())
{}
node_ptr node_pointer() const BOOST_NOEXCEPT_OR_NOTHROW
stable_vector_iterator(const nonconst_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW
: m_pn(other.node_pointer())
{}
BOOST_CONTAINER_FORCEINLINE stable_vector_iterator & operator=(const stable_vector_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW
{ m_pn = other.node_pointer(); return *this; }
BOOST_CONTAINER_FORCEINLINE node_ptr node_pointer() const BOOST_NOEXCEPT_OR_NOTHROW
{ return node_ptr_traits::static_cast_from(m_pn); }
public:

View File

@@ -96,6 +96,10 @@ class vec_iterator
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
Pointer m_ptr;
class nat;
typedef typename dtl::if_c< IsConst
, vec_iterator<Pointer, false>
, nat>::type nonconst_iterator;
public:
BOOST_CONTAINER_FORCEINLINE const Pointer &get_ptr() const BOOST_NOEXCEPT_OR_NOTHROW
@@ -116,10 +120,17 @@ class vec_iterator
: m_ptr() //Value initialization to achieve "null iterators" (N3644)
{}
BOOST_CONTAINER_FORCEINLINE vec_iterator(vec_iterator<Pointer, false> const& other) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE vec_iterator(const vec_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW
: m_ptr(other.get_ptr())
{}
BOOST_CONTAINER_FORCEINLINE vec_iterator(const nonconst_iterator &other) BOOST_NOEXCEPT_OR_NOTHROW
: m_ptr(other.get_ptr())
{}
BOOST_CONTAINER_FORCEINLINE vec_iterator & operator=(const vec_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW
{ m_ptr = other.get_ptr(); return *this; }
//Pointer like operators
BOOST_CONTAINER_FORCEINLINE reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW
{ BOOST_ASSERT(!!m_ptr); return *m_ptr; }