Fix ptrdiff_t namespace in Span. (#3588)

Fix #3587.
This commit is contained in:
trivialfis 2018-08-15 06:04:55 +08:00 committed by Rory Mitchell
parent 2c502784ff
commit 9265964ee7

View File

@ -32,7 +32,7 @@
#include <xgboost/logging.h> // CHECK #include <xgboost/logging.h> // CHECK
#include <cinttypes> // int64_t #include <cinttypes> // int64_t
#include <type_traits> // remove_cv_t #include <type_traits>
/*! /*!
* The version number 1910 is picked up from GSL. * The version number 1910 is picked up from GSL.
@ -237,9 +237,9 @@ class SpanIterator {
/*! /*!
* The extent E of the span returned by subspan is determined as follows: * The extent E of the span returned by subspan is determined as follows:
* *
* - If Count is not std::dynamic_extent, Count; * - If Count is not dynamic_extent, Count;
* - Otherwise, if Extent is not std::dynamic_extent, Extent - Offset; * - Otherwise, if Extent is not dynamic_extent, Extent - Offset;
* - Otherwise, std::dynamic_extent. * - Otherwise, dynamic_extent.
*/ */
template <detail::ptrdiff_t Extent, template <detail::ptrdiff_t Extent,
detail::ptrdiff_t Offset, detail::ptrdiff_t Offset,
@ -269,7 +269,7 @@ struct IsAllowedElementTypeConversion : public std::integral_constant<
template <class T> template <class T>
struct IsSpanOracle : std::false_type {}; struct IsSpanOracle : std::false_type {};
template <class T, std::ptrdiff_t Extent> template <class T, detail::ptrdiff_t Extent>
struct IsSpanOracle<Span<T, Extent>> : std::true_type {}; struct IsSpanOracle<Span<T, Extent>> : std::true_type {};
template <class T> template <class T>
@ -434,7 +434,7 @@ class Span {
XGBOOST_DEVICE Span(const Container& _cont) : size_(_cont.size()), // NOLINT XGBOOST_DEVICE Span(const Container& _cont) : size_(_cont.size()), // NOLINT
data_(_cont.data()) {} data_(_cont.data()) {}
template <class U, ptrdiff_t OtherExtent, template <class U, detail::ptrdiff_t OtherExtent,
class = typename std::enable_if< class = typename std::enable_if<
detail::IsAllowedElementTypeConversion<U, T>::value && detail::IsAllowedElementTypeConversion<U, T>::value &&
detail::IsAllowedExtentConversion<OtherExtent, Extent>::value>> detail::IsAllowedExtentConversion<OtherExtent, Extent>::value>>
@ -538,8 +538,8 @@ class Span {
* If Count is std::dynamic_extent, r.size() == this->size() - Offset; * If Count is std::dynamic_extent, r.size() == this->size() - Offset;
* Otherwise r.size() == Count. * Otherwise r.size() == Count.
*/ */
template < detail::ptrdiff_t Offset, template <detail::ptrdiff_t Offset,
detail::ptrdiff_t Count = dynamic_extent > detail::ptrdiff_t Count = dynamic_extent>
XGBOOST_DEVICE auto subspan() const -> // NOLINT XGBOOST_DEVICE auto subspan() const -> // NOLINT
Span<element_type, Span<element_type,
detail::ExtentValue<Extent, Offset, Count>::value> { detail::ExtentValue<Extent, Offset, Count>::value> {