From 86332b4d3ce532a2a7021934910c536feefaba4f Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 14 Nov 2016 21:29:16 +1100 Subject: [PATCH] view: move array constructor to make_array function --- view.hpp | 8 ++++---- view.ipp | 19 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/view.hpp b/view.hpp index c9468f41..efe06a8f 100644 --- a/view.hpp +++ b/view.hpp @@ -29,10 +29,6 @@ namespace util { public: using value_type = typename std::iterator_traits>::value_type; - template - constexpr explicit - view (const value_type (&arr)[S]) noexcept; - constexpr view (T first, T last) noexcept; @@ -63,6 +59,10 @@ namespace util { T m_end; }; + template + auto + make_view (const T (&)[N]); + template auto make_view (T&); diff --git a/view.ipp b/view.ipp index 3f05056b..60a345c3 100644 --- a/view.ipp +++ b/view.ipp @@ -27,16 +27,6 @@ /////////////////////////////////////////////////////////////////////////////// template -template -constexpr -util::view::view (const value_type(&arr)[S]) noexcept: - m_begin (arr), - m_end (arr + S) -{ ; } - - -//----------------------------------------------------------------------------- -template constexpr util::view::view (T _begin, T _end) noexcept: m_begin (_begin), @@ -171,6 +161,15 @@ util::view::operator== (const view rhs) const noexcept /////////////////////////////////////////////////////////////////////////////// +template +auto +util::make_view (const T (&arr)[N]) +{ + return util::view { arr, arr + N }; +} + + +//----------------------------------------------------------------------------- template auto util::make_view (T &t)