Make boost::distance traversal-category-aware (and constexpr in C++14)

This commit is contained in:
morinmorin
2017-06-30 20:02:53 +09:00
parent 452b1bb7e7
commit 69409ed63a

View File

@@ -15,18 +15,19 @@
# pragma once # pragma once
#endif #endif
#include <boost/iterator/distance.hpp>
#include <boost/range/begin.hpp> #include <boost/range/begin.hpp>
#include <boost/range/end.hpp> #include <boost/range/end.hpp>
#include <boost/range/difference_type.hpp> #include <boost/range/difference_type.hpp>
namespace boost namespace boost
{ {
template< class T > template< class T >
inline BOOST_DEDUCED_TYPENAME range_difference<T>::type inline BOOST_CXX14_CONSTEXPR BOOST_DEDUCED_TYPENAME range_difference<T>::type
distance( const T& r ) distance( const T& r )
{ {
return std::distance( boost::begin( r ), boost::end( r ) ); return boost::distance( boost::begin( r ), boost::end( r ) );
} }
} // namespace 'boost' } // namespace 'boost'