boostorg / container

STL-like containers from Boost
http://www.boost.org/libs/container/
Boost Software License 1.0
100 stars 116 forks source link

Fix gcc -Wdeprecated-copy #105

Closed stac47 closed 5 years ago

stac47 commented 5 years ago

Hello,

I spotted this while compiling FB Folly

/path/include/boost/container/flat_map.hpp:1530:12: error: implicitly-declared 'constexpr boost::container::vec_iterator<std::pair<int, int>*, false>& boost::container:
:vec_iterator<std::pair<int, int>*, false>::operator=(const boost::container::vec_iterator<std::pair<int, int>*, false>&)' is deprecated [-Werror=deprecated-copy]
 1530 |          i = insert(i, impl_value_type(k, ::boost::move(m.m_t)));
In file included from /path/include/boost/container/detail/flat_tree.hpp:30,
                 from /path/include/boost/container/flat_map.hpp:29,
                 from ...
/path/include/boost/container/vector.hpp:119:32: note: because 'boost::container::vec_iterator<std::pair<int, int>*, false>' has user-provided 'boost::container::vec_it
erator<Pointer, IsConst>::vec_iterator(const boost::container::vec_iterator<Pointer, false>&) [with Pointer = std::pair<int, int>*; bool IsConst = false]'
  119 |    BOOST_CONTAINER_FORCEINLINE vec_iterator(vec_iterator<Pointer, false> const& other) BOOST_NOEXCEPT_OR_NOTHROW
      |                                ^~~~~~~~~~~~

As you don't use defaulted syntax ( = default) nor import , I did not dare using defaulted assignment operator syntax nor std::swap.

Stac

igaztanaga commented 5 years ago

The error was present in many container interator, many thanks for the report.