view: make container constructor explicit and constexpr

This commit is contained in:
Danny Robson 2016-06-28 14:09:35 +10:00
parent 722dbbe18f
commit ba2c74449f
2 changed files with 23 additions and 0 deletions

View File

@ -36,6 +36,9 @@ namespace util {
constexpr
view (T first, T last) noexcept;
template <typename K> constexpr explicit view ( K &klass);
template <typename K> constexpr explicit view (const K &klass);
constexpr T& begin (void) noexcept;
constexpr T& end (void) noexcept;

View File

@ -46,6 +46,26 @@ util::view<T>::view (T _begin, T _end) noexcept:
//-----------------------------------------------------------------------------
template <typename T>
template <typename K>
constexpr
util::view<T>::view (K &data):
m_begin (std::begin (data)),
m_end (std::end (data))
{ ; }
//-----------------------------------------------------------------------------
template <typename T>
template <typename K>
constexpr
util::view<T>::view (const K &data):
m_begin (std::begin (data)),
m_end (std::end (data))
{ ; }
///////////////////////////////////////////////////////////////////////////////
template <typename T>
constexpr T&
util::view<T>::begin (void) noexcept
{