Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Jul 6, 2020
1 parent 9894d43 commit 3a10900
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/fizzy/span.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class span
using iterator = T*;
using reverse_iterator = std::reverse_iterator<iterator>;

constexpr span() noexcept = default;
constexpr span() = default;
constexpr span(const span&) = default;

constexpr span(const T* begin, std::size_t size) noexcept : m_begin{begin}, m_size{size} {}
constexpr span(T* begin, std::size_t size) noexcept : m_begin{begin}, m_size{size} {}

constexpr span(std::initializer_list<value_type> init) noexcept
: m_begin{std::data(init)}, m_size{std::size(init)}
Expand All @@ -42,14 +42,14 @@ class span
: m_begin{std::data(container)}, m_size{std::size(container)}
{}

const T& operator[](std::size_t index) const noexcept { return m_begin[index]; }
constexpr T& operator[](std::size_t index) const noexcept { return m_begin[index]; }

[[nodiscard]] std::size_t size() const noexcept { return m_size; }
[[nodiscard]] constexpr std::size_t size() const noexcept { return m_size; }

iterator begin() const noexcept { return m_begin; }
iterator end() const noexcept { return m_begin + m_size; }
constexpr iterator begin() const noexcept { return m_begin; }
constexpr iterator end() const noexcept { return m_begin + m_size; }

reverse_iterator rbegin() const noexcept { return reverse_iterator{end()}; }
reverse_iterator rend() const noexcept { return reverse_iterator{begin()}; }
constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator{end()}; }
constexpr reverse_iterator rend() const noexcept { return reverse_iterator{begin()}; }
};
} // namespace fizzy

0 comments on commit 3a10900

Please sign in to comment.