mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Applied clang-format.
This commit is contained in:
parent
4de3d4e3e3
commit
6fadce975b
@ -740,7 +740,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
constexpr strided_bounds(const index_type& extents, const index_type& strides) noexcept
|
constexpr strided_bounds(const index_type& extents, const index_type& strides) noexcept
|
||||||
: m_extents(extents), m_strides(strides)
|
: m_extents(extents),
|
||||||
|
m_strides(strides)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -837,7 +838,8 @@ public:
|
|||||||
using index_size_type = typename IndexType::value_type;
|
using index_size_type = typename IndexType::value_type;
|
||||||
template <typename Bounds>
|
template <typename Bounds>
|
||||||
explicit bounds_iterator(const Bounds& bnd, value_type curr) noexcept
|
explicit bounds_iterator(const Bounds& bnd, value_type curr) noexcept
|
||||||
: boundary_(bnd.index_bounds()), curr_(std::move(curr))
|
: boundary_(bnd.index_bounds()),
|
||||||
|
curr_(std::move(curr))
|
||||||
{
|
{
|
||||||
static_assert(is_bounds<Bounds>::value, "Bounds type must be provided");
|
static_assert(is_bounds<Bounds>::value, "Bounds type must be provided");
|
||||||
}
|
}
|
||||||
@ -1250,8 +1252,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// construct from pointer + length - multidimensional
|
// construct from pointer + length - multidimensional
|
||||||
constexpr multi_span(pointer data, bounds_type bounds) noexcept
|
constexpr multi_span(pointer data, bounds_type bounds) noexcept : data_(data),
|
||||||
: data_(data), bounds_(std::move(bounds))
|
bounds_(std::move(bounds))
|
||||||
{
|
{
|
||||||
Expects((bounds_.size() > 0 && data != nullptr) || bounds_.size() == 0);
|
Expects((bounds_.size() > 0 && data != nullptr) || bounds_.size() == 0);
|
||||||
}
|
}
|
||||||
@ -1347,7 +1349,8 @@ public:
|
|||||||
typename = std::enable_if_t<std::is_convertible<OtherValueType, ValueType>::value &&
|
typename = std::enable_if_t<std::is_convertible<OtherValueType, ValueType>::value &&
|
||||||
std::is_convertible<OtherBounds, bounds_type>::value>>
|
std::is_convertible<OtherBounds, bounds_type>::value>>
|
||||||
constexpr multi_span(multi_span<OtherValueType, OtherDimensions...> other) noexcept
|
constexpr multi_span(multi_span<OtherValueType, OtherDimensions...> other) noexcept
|
||||||
: data_(other.data_), bounds_(other.bounds_)
|
: data_(other.data_),
|
||||||
|
bounds_(other.bounds_)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,14 +120,16 @@ namespace details
|
|||||||
|
|
||||||
template <class From, class To>
|
template <class From, class To>
|
||||||
struct is_allowed_pointer_conversion
|
struct is_allowed_pointer_conversion
|
||||||
: public std::integral_constant<bool, std::is_pointer<From>::value && std::is_pointer<To>::value &&
|
: public std::integral_constant<bool, std::is_pointer<From>::value &&
|
||||||
|
std::is_pointer<To>::value &&
|
||||||
std::is_convertible<From, To>::value>
|
std::is_convertible<From, To>::value>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class From, class To>
|
template <class From, class To>
|
||||||
struct is_allowed_integral_conversion
|
struct is_allowed_integral_conversion
|
||||||
: public std::integral_constant<bool, std::is_integral<From>::value && std::is_integral<To>::value &&
|
: public std::integral_constant<
|
||||||
|
bool, std::is_integral<From>::value && std::is_integral<To>::value &&
|
||||||
sizeof(From) == sizeof(To) && alignof(From) == alignof(To) &&
|
sizeof(From) == sizeof(To) && alignof(From) == alignof(To) &&
|
||||||
std::is_convertible<From, To>::value>
|
std::is_convertible<From, To>::value>
|
||||||
{
|
{
|
||||||
@ -135,7 +137,8 @@ namespace details
|
|||||||
|
|
||||||
template <std::ptrdiff_t From, std::ptrdiff_t To>
|
template <std::ptrdiff_t From, std::ptrdiff_t To>
|
||||||
struct is_allowed_extent_conversion
|
struct is_allowed_extent_conversion
|
||||||
: public std::integral_constant<bool, From == To || From == gsl::dynamic_extent || To == gsl::dynamic_extent>
|
: public std::integral_constant<bool, From == To || From == gsl::dynamic_extent ||
|
||||||
|
To == gsl::dynamic_extent>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -392,9 +395,7 @@ namespace details
|
|||||||
|
|
||||||
void swap(span_iterator& rhs) noexcept { base_type::swap(rhs); }
|
void swap(span_iterator& rhs) noexcept { base_type::swap(rhs); }
|
||||||
private:
|
private:
|
||||||
constexpr span_iterator(const base_type& base) : base_type(base)
|
constexpr span_iterator(const base_type& base) : base_type(base) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Span>
|
template <typename Span>
|
||||||
@ -521,8 +522,7 @@ public:
|
|||||||
// on Container to be a contiguous sequence container.
|
// on Container to be a contiguous sequence container.
|
||||||
template <class Container,
|
template <class Container,
|
||||||
class = std::enable_if_t<
|
class = std::enable_if_t<
|
||||||
!details::is_span<Container>::value &&
|
!details::is_span<Container>::value && !details::is_std_array<Container>::value &&
|
||||||
!details::is_std_array<Container>::value &&
|
|
||||||
std::is_convertible<typename Container::pointer, pointer>::value &&
|
std::is_convertible<typename Container::pointer, pointer>::value &&
|
||||||
std::is_convertible<typename Container::pointer,
|
std::is_convertible<typename Container::pointer,
|
||||||
decltype(std::declval<Container>().data())>::value>>
|
decltype(std::declval<Container>().data())>::value>>
|
||||||
@ -549,7 +549,8 @@ public:
|
|||||||
details::is_allowed_extent_conversion<OtherExtent, Extent>::value &&
|
details::is_allowed_extent_conversion<OtherExtent, Extent>::value &&
|
||||||
details::is_allowed_element_type_conversion<OtherElementType, element_type>::value>>
|
details::is_allowed_element_type_conversion<OtherElementType, element_type>::value>>
|
||||||
constexpr span(const span<OtherElementType, OtherExtent>& other)
|
constexpr span(const span<OtherElementType, OtherExtent>& other)
|
||||||
: storage_(reinterpret_cast<pointer>(other.data()), details::extent_type<OtherExtent>(other.size()))
|
: storage_(reinterpret_cast<pointer>(other.data()),
|
||||||
|
details::extent_type<OtherExtent>(other.size()))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,7 +560,8 @@ public:
|
|||||||
details::is_allowed_extent_conversion<OtherExtent, Extent>::value &&
|
details::is_allowed_extent_conversion<OtherExtent, Extent>::value &&
|
||||||
details::is_allowed_element_type_conversion<OtherElementType, element_type>::value>>
|
details::is_allowed_element_type_conversion<OtherElementType, element_type>::value>>
|
||||||
constexpr span(span<OtherElementType, OtherExtent>&& other)
|
constexpr span(span<OtherElementType, OtherExtent>&& other)
|
||||||
: storage_(reinterpret_cast<pointer>(other.data()), details::extent_type<OtherExtent>(other.size()))
|
: storage_(reinterpret_cast<pointer>(other.data()),
|
||||||
|
details::extent_type<OtherExtent>(other.size()))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -664,7 +666,8 @@ private:
|
|||||||
|
|
||||||
// [span.comparison], span comparison operators
|
// [span.comparison], span comparison operators
|
||||||
template <class ElementType, std::ptrdiff_t FirstExtent, std::ptrdiff_t SecondExtent>
|
template <class ElementType, std::ptrdiff_t FirstExtent, std::ptrdiff_t SecondExtent>
|
||||||
constexpr bool operator==(const span<ElementType, FirstExtent>& l, const span<ElementType, SecondExtent>& r)
|
constexpr bool operator==(const span<ElementType, FirstExtent>& l,
|
||||||
|
const span<ElementType, SecondExtent>& r)
|
||||||
{
|
{
|
||||||
return std::equal(l.begin(), l.end(), r.begin(), r.end());
|
return std::equal(l.begin(), l.end(), r.begin(), r.end());
|
||||||
}
|
}
|
||||||
|
@ -287,12 +287,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t N, class ArrayElementType = std::remove_const_t<element_type>>
|
template <size_t N, class ArrayElementType = std::remove_const_t<element_type>>
|
||||||
constexpr basic_string_span(std::array<ArrayElementType, N>& arr) noexcept
|
constexpr basic_string_span(std::array<ArrayElementType, N>& arr) noexcept : span_(arr)
|
||||||
: span_(arr) {}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
template <size_t N, class ArrayElementType = std::remove_const_t<element_type>>
|
template <size_t N, class ArrayElementType = std::remove_const_t<element_type>>
|
||||||
constexpr basic_string_span(const std::array<ArrayElementType, N>& arr) noexcept
|
constexpr basic_string_span(const std::array<ArrayElementType, N>& arr) noexcept : span_(arr)
|
||||||
: span_(arr) {}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// Container signature should work for basic_string after C++17 version exists
|
// Container signature should work for basic_string after C++17 version exists
|
||||||
template <class Traits, class Allocator>
|
template <class Traits, class Allocator>
|
||||||
@ -313,7 +315,8 @@ public:
|
|||||||
!details::is_basic_string_span<Container>::value &&
|
!details::is_basic_string_span<Container>::value &&
|
||||||
!details::is_span<Container>::value &&
|
!details::is_span<Container>::value &&
|
||||||
std::is_convertible<typename Container::pointer, pointer>::value &&
|
std::is_convertible<typename Container::pointer, pointer>::value &&
|
||||||
std::is_convertible<typename Container::pointer, decltype(std::declval<Container>().data())>::value>>
|
std::is_convertible<typename Container::pointer,
|
||||||
|
decltype(std::declval<Container>().data())>::value>>
|
||||||
constexpr basic_string_span(Container& cont) : span_(cont)
|
constexpr basic_string_span(Container& cont) : span_(cont)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -323,7 +326,8 @@ public:
|
|||||||
!details::is_basic_string_span<Container>::value &&
|
!details::is_basic_string_span<Container>::value &&
|
||||||
!details::is_span<Container>::value &&
|
!details::is_span<Container>::value &&
|
||||||
std::is_convertible<typename Container::pointer, pointer>::value &&
|
std::is_convertible<typename Container::pointer, pointer>::value &&
|
||||||
std::is_convertible<typename Container::pointer, decltype(std::declval<Container>().data())>::value>>
|
std::is_convertible<typename Container::pointer,
|
||||||
|
decltype(std::declval<Container>().data())>::value>>
|
||||||
constexpr basic_string_span(const Container& cont) : span_(cont)
|
constexpr basic_string_span(const Container& cont) : span_(cont)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -349,7 +353,8 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// from string_span
|
// from string_span
|
||||||
template <class OtherValueType, std::ptrdiff_t OtherExtent,
|
template <
|
||||||
|
class OtherValueType, std::ptrdiff_t OtherExtent,
|
||||||
class = std::enable_if_t<std::is_convertible<
|
class = std::enable_if_t<std::is_convertible<
|
||||||
typename basic_string_span<OtherValueType, OtherExtent>::impl_type, impl_type>::value>>
|
typename basic_string_span<OtherValueType, OtherExtent>::impl_type, impl_type>::value>>
|
||||||
constexpr basic_string_span(basic_string_span<OtherValueType, OtherExtent> other)
|
constexpr basic_string_span(basic_string_span<OtherValueType, OtherExtent> other)
|
||||||
@ -556,8 +561,9 @@ using cwzstring_span = basic_zstring_span<const wchar_t, Max>;
|
|||||||
|
|
||||||
// operator ==
|
// operator ==
|
||||||
template <class CharT, std::ptrdiff_t Extent, class T,
|
template <class CharT, std::ptrdiff_t Extent, class T,
|
||||||
class = std::enable_if_t<details::is_basic_string_span<T>::value || std::is_convertible<
|
class = std::enable_if_t<
|
||||||
T, gsl::basic_string_span<std::add_const_t<CharT>>>::value>>
|
details::is_basic_string_span<T>::value ||
|
||||||
|
std::is_convertible<T, gsl::basic_string_span<std::add_const_t<CharT>>>::value>>
|
||||||
bool operator==(const gsl::basic_string_span<CharT, Extent>& one, const T& other) noexcept
|
bool operator==(const gsl::basic_string_span<CharT, Extent>& one, const T& other) noexcept
|
||||||
{
|
{
|
||||||
gsl::basic_string_span<std::add_const_t<CharT>> tmp(other);
|
gsl::basic_string_span<std::add_const_t<CharT>> tmp(other);
|
||||||
@ -568,11 +574,10 @@ bool operator==(const gsl::basic_string_span<CharT, Extent>& one, const T& other
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <class CharT, std::ptrdiff_t Extent, class T,
|
||||||
class CharT, std::ptrdiff_t Extent, class T,
|
class = std::enable_if_t<
|
||||||
class = std::enable_if_t<!details::is_basic_string_span<T>::value &&
|
!details::is_basic_string_span<T>::value &&
|
||||||
std::is_convertible<T, gsl::basic_string_span<std::add_const_t<CharT>>>::value
|
std::is_convertible<T, gsl::basic_string_span<std::add_const_t<CharT>>>::value>>
|
||||||
>>
|
|
||||||
bool operator==(const T& one, const gsl::basic_string_span<CharT, Extent>& other) noexcept
|
bool operator==(const T& one, const gsl::basic_string_span<CharT, Extent>& other) noexcept
|
||||||
{
|
{
|
||||||
gsl::basic_string_span<std::add_const_t<CharT>> tmp(one);
|
gsl::basic_string_span<std::add_const_t<CharT>> tmp(one);
|
||||||
|
Loading…
Reference in New Issue
Block a user