view: delegate constructors where feasible

this will allow us to reduce code duplication for sanity checks at
construction time.
This commit is contained in:
Danny Robson 2017-12-15 18:58:33 +11:00
parent b4175e4593
commit 60a7670326

View File

@ -49,8 +49,7 @@ namespace util {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
constexpr constexpr
view (const view &rhs) noexcept: view (const view &rhs) noexcept:
m_begin (rhs.m_begin), view (rhs.m_begin, rhs.m_end)
m_end (rhs.m_end)
{ ; } { ; }
@ -60,19 +59,15 @@ namespace util {
// class as a base for unique owning pointers without exposing // class as a base for unique owning pointers without exposing
// begin/end to them directly. // begin/end to them directly.
constexpr view (view &&rhs) noexcept: constexpr view (view &&rhs) noexcept:
view (IteratorT{}, IteratorT{}) view (std::move (rhs.m_begin), std::move (rhs.m_end))
{ { ; }
std::swap (m_begin, rhs.m_begin);
std::swap (m_end, rhs.m_end);
}
//--------------------------------------------------------------------- //---------------------------------------------------------------------
template <typename ContainerT> template <typename ContainerT>
constexpr explicit constexpr explicit
view (ContainerT &klass): view (ContainerT &klass):
m_begin (std::begin (klass)), view (std::begin (klass), std::end (klass))
m_end (std::end (klass))
{ ; } { ; }
@ -80,8 +75,7 @@ namespace util {
template <typename ContainerT> template <typename ContainerT>
constexpr explicit constexpr explicit
view (const ContainerT &klass): view (const ContainerT &klass):
m_begin (std::begin (klass)), view (std::begin (klass), std::end (klass))
m_end (std::end (klass))
{ ; } { ; }