mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Minor compilation fixes and workarounds.
This commit is contained in:
parent
16d1e77568
commit
14d50a6f77
@ -1408,7 +1408,8 @@ public:
|
||||
{}
|
||||
|
||||
// reshape
|
||||
template <typename... Dimensions2, typename = std::enable_if_t<(sizeof...(Dimensions2) > 0)>>
|
||||
// DimCount here is a workaround for a bug in MSVC 2015
|
||||
template <typename... Dimensions2, size_t DimCount = sizeof...(Dimensions2), typename = std::enable_if_t<(DimCount > 0)>>
|
||||
constexpr array_view<ValueType, Dimensions2::value...> as_array_view(Dimensions2... dims)
|
||||
{
|
||||
using BoundsType = typename array_view<ValueType, (Dimensions2::value)...>::bounds_type;
|
||||
|
@ -78,13 +78,13 @@ using cwstring_view = basic_string_view<const wchar_t, Extent>;
|
||||
//
|
||||
// Will fail-fast if sentinel cannot be found before max elements are examined.
|
||||
//
|
||||
template<class T, class SizeType, const T Sentinel>
|
||||
array_view<T, dynamic_range> ensure_sentinel(const T* seq, SizeType max = std::numeric_limits<SizeType>::max())
|
||||
template<class T, const T Sentinel>
|
||||
array_view<T, dynamic_range> ensure_sentinel(const T* seq, std::ptrdiff_t max = PTRDIFF_MAX)
|
||||
{
|
||||
auto cur = seq;
|
||||
while (SizeType(cur - seq) < max && *cur != Sentinel) ++cur;
|
||||
while ((cur - seq) < max && *cur != Sentinel) ++cur;
|
||||
fail_fast_assert(*cur == Sentinel);
|
||||
return{ seq, SizeType(cur - seq) };
|
||||
return{ seq, cur - seq };
|
||||
}
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ array_view<T, dynamic_range> ensure_sentinel(const T* seq, SizeType max = std::n
|
||||
template<class T>
|
||||
inline basic_string_view<T, dynamic_range> ensure_z(T* const & sz, std::ptrdiff_t max = PTRDIFF_MAX)
|
||||
{
|
||||
return ensure_sentinel<T, size_t, 0>(sz, max);
|
||||
return ensure_sentinel<T, 0>(sz, max);
|
||||
}
|
||||
|
||||
// TODO (neilmac) there is probably a better template-magic way to get the const and non-const overloads to share an implementation
|
||||
|
Loading…
Reference in New Issue
Block a user