From 722dbbe18fe0f5f5ec057d59d69132036691232b Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Tue, 28 Jun 2016 14:06:02 +1000 Subject: [PATCH] view: use decltype for make_view type deduction some types will not have iterator typedefs but are capable of providing iterators. use the types that std::begin and friends return instead of deducing them ourselves. --- view.hpp | 4 ++-- view.ipp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/view.hpp b/view.hpp index 3505cf13..ca5c8c9d 100644 --- a/view.hpp +++ b/view.hpp @@ -61,11 +61,11 @@ namespace util { }; template - view + auto make_view (T&); template - view + auto make_view (const T&); template diff --git a/view.ipp b/view.ipp index 0f926560..7dcf9622 100644 --- a/view.ipp +++ b/view.ipp @@ -152,17 +152,17 @@ util::view::operator== (const view rhs) const noexcept /////////////////////////////////////////////////////////////////////////////// template -util::view +auto util::make_view (T &t) { - return util::view { t.begin (), t.end () }; + return util::view { t.begin (), t.end () }; } //----------------------------------------------------------------------------- template -util::view +auto util::make_view (const T &t) { - return util::view { t.cbegin (), t.cend () }; + return util::view { t.cbegin (), t.cend () }; }