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");
}
@ -1132,7 +1134,7 @@ namespace details
template <typename T, typename Arg, typename... Args>
std::enable_if_t<
!std::is_same<Arg, dim<dynamic_range>>::value && !std::is_same<Arg, Sep>::value, T>
static_as_span_helper(Arg, Args... args)
static_as_span_helper(Arg, Args... args)
{
return static_as_span_helper<T>(args...);
}
@ -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,30 +120,33 @@ 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 &&
std::is_convertible<From, 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 &&
sizeof(From) == sizeof(To) && alignof(From) == alignof(To) &&
std::is_convertible<From, 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>
{
};
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>
{
};
template <class From, class To>
struct is_allowed_element_type_conversion
: public std::integral_constant<bool, std::is_same<From, std::remove_cv_t<To>>::value ||
is_allowed_pointer_conversion<From, To>::value ||
is_allowed_integral_conversion<From, To>::value>
is_allowed_pointer_conversion<From, To>::value ||
is_allowed_integral_conversion<From, To>::value>
{
};
@ -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>
@ -431,7 +432,7 @@ namespace details
class extent_type
{
public:
using index_type = std::ptrdiff_t;
using index_type = std::ptrdiff_t;
static_assert(Ext >= 0, "A fixed-size span must be >= 0 in size.");
@ -454,7 +455,7 @@ namespace details
class extent_type<dynamic_extent>
{
public:
using index_type = std::ptrdiff_t;
using index_type = std::ptrdiff_t;
template <index_type Other>
explicit constexpr extent_type(extent_type<Other> ext) : size_(ext.size())
@ -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());
}
@ -711,7 +714,7 @@ namespace details
struct calculate_byte_size
: std::integral_constant<std::ptrdiff_t,
static_cast<std::ptrdiff_t>(sizeof(ElementType) *
static_cast<std::size_t>(Extent))>
static_cast<std::size_t>(Extent))>
{
};

View File

@ -287,23 +287,25 @@ 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>
constexpr basic_string_span(std::basic_string<element_type, Traits, Allocator>& str)
: span_(&str[0], str.length())
: span_(&str[0], str.length())
{
}
template <class Traits, class Allocator>
constexpr basic_string_span(const std::basic_string<element_type, Traits, Allocator>& str)
: span_(&str[0], str.length())
: span_(&str[0], str.length())
{
}
@ -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,9 +353,10 @@ public:
#endif
// from string_span
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>>
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)
: span_(other.data(), other.length())
{
@ -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);