diff --git a/include/boost/gil/algorithm.hpp b/include/boost/gil/algorithm.hpp index 2b6106883..6f5a0013e 100644 --- a/include/boost/gil/algorithm.hpp +++ b/include/boost/gil/algorithm.hpp @@ -143,30 +143,24 @@ namespace std { template BOOST_FORCEINLINE auto copy( - boost::gil::pixel* first, - boost::gil::pixel* last, + boost::gil::pixel const* first, + boost::gil::pixel const* last, boost::gil::pixel* dst) -> boost::gil::pixel* { - auto p = std::copy((unsigned char*)first, (unsigned char*)last, (unsigned char*)dst); + auto p = std::copy( + reinterpret_cast(first), + reinterpret_cast(last), + reinterpret_cast(dst)); return reinterpret_cast*>(p); } -/// \ingroup STLOptimizations -/// \brief Copy when both src and dst are interleaved and of the same type can be just memmove -template -BOOST_FORCEINLINE -auto copy(const boost::gil::pixel* first, const boost::gil::pixel* last, - boost::gil::pixel* dst) -> boost::gil::pixel* -{ - return (boost::gil::pixel*)std::copy((unsigned char*)first,(unsigned char*)last, (unsigned char*)dst); -} } // namespace std namespace boost { namespace gil { namespace detail { template struct copy_fn { - BOOST_FORCEINLINE I operator()(I first, I last, O dst) const { return std::copy(first,last,dst); } + BOOST_FORCEINLINE O operator()(I first, I last, O dst) const { return std::copy(first,last,dst); } }; } // namespace detail } } // namespace boost::gil @@ -454,8 +448,9 @@ void destruct_range_impl(Iterator first, Iterator last, detail::is_trivially_destructible::value_type> > >::value - >::type* /*ptr*/ = 0) + >::type* /* ptr */ = nullptr) { + using value_t = typename std::iterator_traits::value_type; while (first != last) { first->~value_t();