Applied clang-format.

This commit is contained in:
Neil MacIntosh 2016-07-26 19:19:47 -07:00
parent 4de3d4e3e3
commit 6fadce975b
3 changed files with 69 additions and 58 deletions

View File

@ -740,7 +740,8 @@ public:
}
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;
template <typename Bounds>
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");
}
@ -1250,8 +1252,8 @@ public:
}
// construct from pointer + length - multidimensional
constexpr multi_span(pointer data, bounds_type bounds) noexcept
: data_(data), bounds_(std::move(bounds))
constexpr multi_span(pointer data, bounds_type bounds) noexcept : data_(data),
bounds_(std::move(bounds))
{
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 &&
std::is_convertible<OtherBounds, bounds_type>::value>>
constexpr multi_span(multi_span<OtherValueType, OtherDimensions...> other) noexcept
: data_(other.data_), bounds_(other.bounds_)
: data_(other.data_),
bounds_(other.bounds_)
{
}

View File

@ -120,14 +120,16 @@ namespace details
template <class From, class To>
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>
{
};
template <class From, class To>
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) &&
std::is_convertible<From, To>::value>
{
@ -135,7 +137,8 @@ namespace details
template <std::ptrdiff_t From, std::ptrdiff_t To>
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); }
private:
constexpr span_iterator(const base_type& base) : base_type(base)
{
}
constexpr span_iterator(const base_type& base) : base_type(base) {}
};
template <typename Span>
@ -521,8 +522,7 @@ public:
// on Container to be a contiguous sequence container.
template <class Container,
class = std::enable_if_t<
!details::is_span<Container>::value &&
!details::is_std_array<Container>::value &&
!details::is_span<Container>::value && !details::is_std_array<Container>::value &&
std::is_convertible<typename Container::pointer, pointer>::value &&
std::is_convertible<typename Container::pointer,
decltype(std::declval<Container>().data())>::value>>
@ -549,7 +549,8 @@ public:
details::is_allowed_extent_conversion<OtherExtent, Extent>::value &&
details::is_allowed_element_type_conversion<OtherElementType, element_type>::value>>
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_element_type_conversion<OtherElementType, element_type>::value>>
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
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());
}

View File

@ -287,12 +287,14 @@ public:
}
template <size_t N, class ArrayElementType = std::remove_const_t<element_type>>
constexpr basic_string_span(std::array<ArrayElementType, N>& arr) noexcept
: span_(arr) {}
constexpr basic_string_span(std::array<ArrayElementType, N>& arr) noexcept : span_(arr)
{
}
template <size_t N, class ArrayElementType = std::remove_const_t<element_type>>
constexpr basic_string_span(const std::array<ArrayElementType, N>& arr) noexcept
: span_(arr) {}
constexpr basic_string_span(const std::array<ArrayElementType, N>& arr) noexcept : span_(arr)
{
}
// Container signature should work for basic_string after C++17 version exists
template <class Traits, class Allocator>
@ -313,7 +315,8 @@ public:
!details::is_basic_string_span<Container>::value &&
!details::is_span<Container>::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)
{
}
@ -323,7 +326,8 @@ public:
!details::is_basic_string_span<Container>::value &&
!details::is_span<Container>::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)
{
}
@ -349,7 +353,8 @@ public:
#endif
// 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<
typename basic_string_span<OtherValueType, OtherExtent>::impl_type, impl_type>::value>>
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 ==
template <class CharT, std::ptrdiff_t Extent, class T,
class = std::enable_if_t<details::is_basic_string_span<T>::value || std::is_convertible<
T, gsl::basic_string_span<std::add_const_t<CharT>>>::value>>
class = std::enable_if_t<
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
{
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
}
template <
class CharT, std::ptrdiff_t Extent, class T,
class = std::enable_if_t<!details::is_basic_string_span<T>::value &&
std::is_convertible<T, gsl::basic_string_span<std::add_const_t<CharT>>>::value
>>
template <class CharT, std::ptrdiff_t Extent, class T,
class = std::enable_if_t<
!details::is_basic_string_span<T>::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
{
gsl::basic_string_span<std::add_const_t<CharT>> tmp(one);