fuzz/span.h: Format with clang-format
BRANCH=none
TEST=none
#include <algorithm>
-namespace fuzz {
+namespace fuzz
+{
-template <typename T>
-class span {
+template <typename T> class span {
public:
typedef T value_type;
- constexpr span() : span<T>(nullptr, nullptr) {}
- constexpr span(T* begin, size_t size) : begin_(begin), end_(begin + size) {}
- constexpr span(T* begin, T* end) : begin_(begin), end_(end) {}
+ constexpr span()
+ : span<T>(nullptr, nullptr)
+ {
+ }
+ constexpr span(T *begin, size_t size)
+ : begin_(begin)
+ , end_(begin + size)
+ {
+ }
+ constexpr span(T *begin, T *end)
+ : begin_(begin)
+ , end_(end)
+ {
+ }
template <class Container>
constexpr span(Container &container)
- : begin_(container.begin()), end_(container.end()){};
+ : begin_(container.begin())
+ , end_(container.end()){};
- constexpr T* begin() const { return begin_; }
- constexpr T* end() const { return end_; }
+ constexpr T *begin() const
+ {
+ return begin_;
+ }
+ constexpr T *end() const
+ {
+ return end_;
+ }
- constexpr T* data() const { return begin_; }
+ constexpr T *data() const
+ {
+ return begin_;
+ }
- constexpr bool empty() const { return begin_ == end_; }
- constexpr size_t size() const { return end_ - begin_; }
+ constexpr bool empty() const
+ {
+ return begin_ == end_;
+ }
+ constexpr size_t size() const
+ {
+ return end_ - begin_;
+ }
private:
T *begin_;
@@ -38,16 +65,17 @@ class span {
};
template <typename Source, typename Destination>
-size_t CopyWithPadding(Source source,
- Destination destination,
- typename Destination::value_type fill_value) {
+size_t CopyWithPadding(Source source, Destination destination,
+ typename Destination::value_type fill_value)
+{
if (source.size() >= destination.size()) {
std::copy(source.begin(), source.begin() + destination.size(),
destination.begin());
return destination.size();
}
std::copy(source.begin(), source.end(), destination.begin());
- std::fill(destination.begin() + source.size(), destination.end(), fill_value);
+ std::fill(destination.begin() + source.size(), destination.end(),
+ fill_value);
return source.size();
}
