Skip to content

Commit

Permalink
Merge pull request #255 from nmm0/254-qualify-std-namespace
Browse files Browse the repository at this point in the history
#254: qualify `std` namespace
  • Loading branch information
crtrott committed Apr 20, 2023
2 parents 9ceface + 9cbff58 commit edf3ba8
Show file tree
Hide file tree
Showing 13 changed files with 233 additions and 230 deletions.
2 changes: 1 addition & 1 deletion include/experimental/__p0009_bits/default_accessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct default_accessor {
MDSPAN_TEMPLATE_REQUIRES(
class OtherElementType,
/* requires */ (
_MDSPAN_TRAIT(is_convertible, OtherElementType(*)[], element_type(*)[])
_MDSPAN_TRAIT(std::is_convertible, OtherElementType(*)[], element_type(*)[])
)
)
MDSPAN_INLINE_FUNCTION
Expand Down
22 changes: 11 additions & 11 deletions include/experimental/__p0009_bits/extents.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ template <class T> struct possibly_empty_array<T, 0> {
template <class TDynamic, class TStatic, TStatic dyn_tag, TStatic... Values>
struct maybe_static_array {

static_assert(is_convertible<TStatic, TDynamic>::value, "maybe_static_array: TStatic must be convertible to TDynamic");
static_assert(is_convertible<TDynamic, TStatic>::value, "maybe_static_array: TDynamic must be convertible to TStatic");
static_assert(std::is_convertible<TStatic, TDynamic>::value, "maybe_static_array: TStatic must be convertible to TDynamic");
static_assert(std::is_convertible<TDynamic, TStatic>::value, "maybe_static_array: TDynamic must be convertible to TStatic");

private:
// Static values member
Expand Down Expand Up @@ -373,7 +373,7 @@ template <class IndexType, size_t... Extents> class extents {
public:
// typedefs for integral types used
using index_type = IndexType;
using size_type = make_unsigned_t<index_type>;
using size_type = std::make_unsigned_t<index_type>;
using rank_type = size_t;

static_assert(std::is_integral<index_type>::value && !std::is_same<index_type, bool>::value,
Expand Down Expand Up @@ -411,9 +411,9 @@ template <class IndexType, size_t... Extents> class extents {
MDSPAN_TEMPLATE_REQUIRES(
class... OtherIndexTypes,
/* requires */ (
_MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, OtherIndexTypes,
_MDSPAN_FOLD_AND(_MDSPAN_TRAIT(std::is_convertible, OtherIndexTypes,
index_type) /* && ... */) &&
_MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_nothrow_constructible, index_type,
_MDSPAN_FOLD_AND(_MDSPAN_TRAIT(std::is_nothrow_constructible, index_type,
OtherIndexTypes) /* && ... */) &&
(sizeof...(OtherIndexTypes) == m_rank ||
sizeof...(OtherIndexTypes) == m_rank_dynamic)))
Expand All @@ -425,25 +425,25 @@ template <class IndexType, size_t... Extents> class extents {
class OtherIndexType, size_t N,
/* requires */
(
_MDSPAN_TRAIT(is_convertible, OtherIndexType, index_type) &&
_MDSPAN_TRAIT(is_nothrow_constructible, index_type,
_MDSPAN_TRAIT(std::is_convertible, OtherIndexType, index_type) &&
_MDSPAN_TRAIT(std::is_nothrow_constructible, index_type,
OtherIndexType) &&
(N == m_rank || N == m_rank_dynamic)))
MDSPAN_INLINE_FUNCTION
MDSPAN_CONDITIONAL_EXPLICIT(N != m_rank_dynamic)
constexpr extents(const array<OtherIndexType, N> &exts) noexcept
constexpr extents(const std::array<OtherIndexType, N> &exts) noexcept
: m_vals(std::move(exts)) {}

#ifdef __cpp_lib_span
MDSPAN_TEMPLATE_REQUIRES(
class OtherIndexType, size_t N,
/* requires */
(_MDSPAN_TRAIT(is_convertible, OtherIndexType, index_type) &&
_MDSPAN_TRAIT(is_nothrow_constructible, index_type, OtherIndexType) &&
(_MDSPAN_TRAIT(std::is_convertible, OtherIndexType, index_type) &&
_MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, OtherIndexType) &&
(N == m_rank || N == m_rank_dynamic)))
MDSPAN_INLINE_FUNCTION
MDSPAN_CONDITIONAL_EXPLICIT(N != m_rank_dynamic)
constexpr extents(const span<OtherIndexType, N> &exts) noexcept
constexpr extents(const std::span<OtherIndexType, N> &exts) noexcept
: m_vals(std::move(exts)) {}
#endif

Expand Down
18 changes: 9 additions & 9 deletions include/experimental/__p0009_bits/layout_left.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ class layout_left::mapping {
MDSPAN_TEMPLATE_REQUIRES(
class OtherExtents,
/* requires */ (
_MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents)
_MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents)
)
)
MDSPAN_CONDITIONAL_EXPLICIT((!is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma
MDSPAN_CONDITIONAL_EXPLICIT((!std::is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma
MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14
mapping(mapping<OtherExtents> const& other) noexcept // NOLINT(google-explicit-constructor)
:__extents(other.extents())
Expand All @@ -93,11 +93,11 @@ class layout_left::mapping {
MDSPAN_TEMPLATE_REQUIRES(
class OtherExtents,
/* requires */ (
_MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents) &&
_MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents) &&
(extents_type::rank() <= 1)
)
)
MDSPAN_CONDITIONAL_EXPLICIT((!is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma
MDSPAN_CONDITIONAL_EXPLICIT((!std::is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma
MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14
mapping(layout_right::mapping<OtherExtents> const& other) noexcept // NOLINT(google-explicit-constructor)
:__extents(other.extents())
Expand All @@ -111,7 +111,7 @@ class layout_left::mapping {
MDSPAN_TEMPLATE_REQUIRES(
class OtherExtents,
/* requires */ (
_MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents)
_MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents)
)
)
MDSPAN_CONDITIONAL_EXPLICIT((extents_type::rank() > 0))
Expand Down Expand Up @@ -156,8 +156,8 @@ class layout_left::mapping {
/* requires */ (
(sizeof...(Indices) == extents_type::rank()) &&
_MDSPAN_FOLD_AND(
(_MDSPAN_TRAIT(is_convertible, Indices, index_type) &&
_MDSPAN_TRAIT(is_nothrow_constructible, index_type, Indices))
(_MDSPAN_TRAIT(std::is_convertible, Indices, index_type) &&
_MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, Indices))
)
)
)
Expand Down Expand Up @@ -204,12 +204,12 @@ class layout_left::mapping {

// Not really public, but currently needed to implement fully constexpr useable submdspan:
template<size_t N, class SizeType, size_t ... E, size_t ... Idx>
constexpr index_type __get_stride(std::experimental::extents<SizeType, E...>,integer_sequence<size_t, Idx...>) const {
constexpr index_type __get_stride(std::experimental::extents<SizeType, E...>,std::integer_sequence<size_t, Idx...>) const {
return _MDSPAN_FOLD_TIMES_RIGHT((Idx<N? __extents.template __extent<Idx>():1),1);
}
template<size_t N>
constexpr index_type __stride() const noexcept {
return __get_stride<N>(__extents, make_index_sequence<extents_type::rank()>());
return __get_stride<N>(__extents, std::make_index_sequence<extents_type::rank()>());
}

private:
Expand Down
18 changes: 9 additions & 9 deletions include/experimental/__p0009_bits/layout_right.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ class layout_right::mapping {
MDSPAN_TEMPLATE_REQUIRES(
class OtherExtents,
/* requires */ (
_MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents)
_MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents)
)
)
MDSPAN_CONDITIONAL_EXPLICIT((!is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma
MDSPAN_CONDITIONAL_EXPLICIT((!std::is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma
MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14
mapping(mapping<OtherExtents> const& other) noexcept // NOLINT(google-explicit-constructor)
:__extents(other.extents())
Expand All @@ -98,11 +98,11 @@ class layout_right::mapping {
MDSPAN_TEMPLATE_REQUIRES(
class OtherExtents,
/* requires */ (
_MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents) &&
_MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents) &&
(extents_type::rank() <= 1)
)
)
MDSPAN_CONDITIONAL_EXPLICIT((!is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma
MDSPAN_CONDITIONAL_EXPLICIT((!std::is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma
MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14
mapping(layout_left::mapping<OtherExtents> const& other) noexcept // NOLINT(google-explicit-constructor)
:__extents(other.extents())
Expand All @@ -116,7 +116,7 @@ class layout_right::mapping {
MDSPAN_TEMPLATE_REQUIRES(
class OtherExtents,
/* requires */ (
_MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents)
_MDSPAN_TRAIT(std::is_constructible, extents_type, OtherExtents)
)
)
MDSPAN_CONDITIONAL_EXPLICIT((extents_type::rank() > 0))
Expand Down Expand Up @@ -161,8 +161,8 @@ class layout_right::mapping {
/* requires */ (
(sizeof...(Indices) == extents_type::rank()) &&
_MDSPAN_FOLD_AND(
(_MDSPAN_TRAIT(is_convertible, Indices, index_type) &&
_MDSPAN_TRAIT(is_nothrow_constructible, index_type, Indices))
(_MDSPAN_TRAIT(std::is_convertible, Indices, index_type) &&
_MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, Indices))
)
)
)
Expand Down Expand Up @@ -206,12 +206,12 @@ class layout_right::mapping {

// Not really public, but currently needed to implement fully constexpr useable submdspan:
template<size_t N, class SizeType, size_t ... E, size_t ... Idx>
constexpr index_type __get_stride(std::experimental::extents<SizeType, E...>,integer_sequence<size_t, Idx...>) const {
constexpr index_type __get_stride(std::experimental::extents<SizeType, E...>,std::integer_sequence<size_t, Idx...>) const {
return _MDSPAN_FOLD_TIMES_RIGHT((Idx>N? __extents.template __extent<Idx>():1),1);
}
template<size_t N>
constexpr index_type __stride() const noexcept {
return __get_stride<N>(__extents, make_index_sequence<extents_type::rank()>());
return __get_stride<N>(__extents, std::make_index_sequence<extents_type::rank()>());
}

private:
Expand Down
54 changes: 27 additions & 27 deletions include/experimental/__p0009_bits/layout_stride.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ struct layout_right {
namespace detail {
template<class Layout, class Mapping>
constexpr bool __is_mapping_of =
is_same<typename Layout::template mapping<typename Mapping::extents_type>, Mapping>::value;
std::is_same<typename Layout::template mapping<typename Mapping::extents_type>, Mapping>::value;

#if defined(_MDSPAN_USE_CONCEPTS) && MDSPAN_HAS_CXX_20
template<class M>
concept __layout_mapping_alike = requires {
requires __is_extents<typename M::extents_type>::value;
{ M::is_always_strided() } -> same_as<bool>;
{ M::is_always_exhaustive() } -> same_as<bool>;
{ M::is_always_unique() } -> same_as<bool>;
bool_constant<M::is_always_strided()>::value;
bool_constant<M::is_always_exhaustive()>::value;
bool_constant<M::is_always_unique()>::value;
{ M::is_always_strided() } -> std::same_as<bool>;
{ M::is_always_exhaustive() } -> std::same_as<bool>;
{ M::is_always_unique() } -> std::same_as<bool>;
std::bool_constant<M::is_always_strided()>::value;
std::bool_constant<M::is_always_exhaustive()>::value;
std::bool_constant<M::is_always_unique()>::value;
};
#endif
} // namespace detail
Expand Down Expand Up @@ -92,7 +92,7 @@ struct layout_stride {

//----------------------------------------------------------------------------

using __strides_storage_t = array<index_type, extents_type::rank()>;//::std::experimental::dextents<index_type, extents_type::rank()>;
using __strides_storage_t = std::array<index_type, extents_type::rank()>;
using __member_pair_t = detail::__compressed_pair<extents_type, __strides_storage_t>;

#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
Expand All @@ -118,9 +118,9 @@ struct layout_stride {
#endif
}

template<class SizeType, ::std::size_t ... Ep, ::std::size_t ... Idx>
template<class SizeType, size_t ... Ep, size_t ... Idx>
_MDSPAN_HOST_DEVICE
constexpr index_type __get_size(::std::experimental::extents<SizeType, Ep...>,integer_sequence<::std::size_t, Idx...>) const {
constexpr index_type __get_size(::std::experimental::extents<SizeType, Ep...>,std::integer_sequence<size_t, Idx...>) const {
return _MDSPAN_FOLD_TIMES_RIGHT( static_cast<index_type>(extents().extent(Idx)), 1 );
}

Expand All @@ -136,7 +136,7 @@ struct layout_stride {
struct __deduction_workaround;

template <size_t... Idxs>
struct __deduction_workaround<index_sequence<Idxs...>>
struct __deduction_workaround<std::index_sequence<Idxs...>>
{
template <class OtherExtents>
MDSPAN_INLINE_FUNCTION
Expand Down Expand Up @@ -176,14 +176,14 @@ struct layout_stride {

template<class IntegralType>
MDSPAN_INLINE_FUNCTION
static constexpr const __strides_storage_t fill_strides(const array<IntegralType,extents_type::rank()>& s) {
static constexpr const __strides_storage_t fill_strides(const std::array<IntegralType,extents_type::rank()>& s) {
return __strides_storage_t{static_cast<index_type>(s[Idxs])...};
}

#ifdef __cpp_lib_span
template<class IntegralType>
MDSPAN_INLINE_FUNCTION
static constexpr const __strides_storage_t fill_strides(const span<IntegralType,extents_type::rank()>& s) {
static constexpr const __strides_storage_t fill_strides(const std::span<IntegralType,extents_type::rank()>& s) {
return __strides_storage_t{static_cast<index_type>(s[Idxs])...};
}
#endif
Expand All @@ -199,7 +199,7 @@ struct layout_stride {
};

// Can't use defaulted parameter in the __deduction_workaround template because of a bug in MSVC warning C4348.
using __impl = __deduction_workaround<make_index_sequence<Extents::rank()>>;
using __impl = __deduction_workaround<std::make_index_sequence<Extents::rank()>>;


//----------------------------------------------------------------------------
Expand All @@ -224,15 +224,15 @@ struct layout_stride {
/* requires */ (
// MSVC 19.32 does not like using index_type here, requires the typename Extents::index_type
// error C2641: cannot deduce template arguments for 'std::experimental::layout_stride::mapping'
_MDSPAN_TRAIT(is_convertible, const remove_const_t<IntegralTypes>&, typename Extents::index_type) &&
_MDSPAN_TRAIT(is_nothrow_constructible, typename Extents::index_type, const remove_const_t<IntegralTypes>&)
_MDSPAN_TRAIT(std::is_convertible, const std::remove_const_t<IntegralTypes>&, typename Extents::index_type) &&
_MDSPAN_TRAIT(std::is_nothrow_constructible, typename Extents::index_type, const std::remove_const_t<IntegralTypes>&)
)
)
MDSPAN_INLINE_FUNCTION
constexpr
mapping(
extents_type const& e,
array<IntegralTypes, extents_type::rank()> const& s
std::array<IntegralTypes, extents_type::rank()> const& s
) noexcept
#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
: __members{
Expand Down Expand Up @@ -262,15 +262,15 @@ struct layout_stride {
/* requires */ (
// MSVC 19.32 does not like using index_type here, requires the typename Extents::index_type
// error C2641: cannot deduce template arguments for 'std::experimental::layout_stride::mapping'
_MDSPAN_TRAIT(is_convertible, const remove_const_t<IntegralTypes>&, typename Extents::index_type) &&
_MDSPAN_TRAIT(is_nothrow_constructible, typename Extents::index_type, const remove_const_t<IntegralTypes>&)
_MDSPAN_TRAIT(std::is_convertible, const std::remove_const_t<IntegralTypes>&, typename Extents::index_type) &&
_MDSPAN_TRAIT(std::is_nothrow_constructible, typename Extents::index_type, const std::remove_const_t<IntegralTypes>&)
)
)
MDSPAN_INLINE_FUNCTION
constexpr
mapping(
extents_type const& e,
span<IntegralTypes, extents_type::rank()> const& s
std::span<IntegralTypes, extents_type::rank()> const& s
) noexcept
#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
: __members{
Expand Down Expand Up @@ -299,7 +299,7 @@ struct layout_stride {
MDSPAN_TEMPLATE_REQUIRES(
class StridedLayoutMapping,
/* requires */ (
_MDSPAN_TRAIT(is_constructible, extents_type, typename StridedLayoutMapping::extents_type) &&
_MDSPAN_TRAIT(std::is_constructible, extents_type, typename StridedLayoutMapping::extents_type) &&
detail::__is_mapping_of<typename StridedLayoutMapping::layout_type, StridedLayoutMapping> &&
StridedLayoutMapping::is_always_unique() &&
StridedLayoutMapping::is_always_strided()
Expand All @@ -309,13 +309,13 @@ struct layout_stride {
template<class StridedLayoutMapping>
requires(
detail::__layout_mapping_alike<StridedLayoutMapping> &&
_MDSPAN_TRAIT(is_constructible, extents_type, typename StridedLayoutMapping::extents_type) &&
_MDSPAN_TRAIT(std::is_constructible, extents_type, typename StridedLayoutMapping::extents_type) &&
StridedLayoutMapping::is_always_unique() &&
StridedLayoutMapping::is_always_strided()
)
#endif
MDSPAN_CONDITIONAL_EXPLICIT(
(!is_convertible<typename StridedLayoutMapping::extents_type, extents_type>::value) &&
(!std::is_convertible<typename StridedLayoutMapping::extents_type, extents_type>::value) &&
(detail::__is_mapping_of<layout_left, StridedLayoutMapping> ||
detail::__is_mapping_of<layout_right, StridedLayoutMapping> ||
detail::__is_mapping_of<layout_stride, StridedLayoutMapping>)
Expand Down Expand Up @@ -356,7 +356,7 @@ struct layout_stride {
};

MDSPAN_INLINE_FUNCTION
constexpr array< index_type, extents_type::rank() > strides() const noexcept {
constexpr std::array< index_type, extents_type::rank() > strides() const noexcept {
return __strides_storage();
}

Expand All @@ -376,8 +376,8 @@ struct layout_stride {
class... Indices,
/* requires */ (
sizeof...(Indices) == Extents::rank() &&
_MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, Indices, index_type) /*&& ...*/ ) &&
_MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_nothrow_constructible, index_type, Indices) /*&& ...*/)
_MDSPAN_FOLD_AND(_MDSPAN_TRAIT(std::is_convertible, Indices, index_type) /*&& ...*/ ) &&
_MDSPAN_FOLD_AND(_MDSPAN_TRAIT(std::is_nothrow_constructible, index_type, Indices) /*&& ...*/)
)
)
MDSPAN_FORCE_INLINE_FUNCTION
Expand All @@ -393,7 +393,7 @@ struct layout_stride {

MDSPAN_INLINE_FUNCTION static constexpr bool is_unique() noexcept { return true; }
MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 bool is_exhaustive() const noexcept {
return required_span_size() == __get_size(extents(), make_index_sequence<extents_type::rank()>());
return required_span_size() == __get_size(extents(), std::make_index_sequence<extents_type::rank()>());
}
MDSPAN_INLINE_FUNCTION static constexpr bool is_strided() noexcept { return true; }

Expand Down
Loading

0 comments on commit edf3ba8

Please sign in to comment.