From 7e5c6a4eb4aef7671efa6f21c82eac4a9b2fefcb Mon Sep 17 00:00:00 2001 From: cxl Date: Wed, 10 Jan 2018 17:26:40 +0000 Subject: [PATCH] Universal reference for algo git-svn-id: svn://ultimatepp.org/upp/trunk@11678 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Range.h | 6 +++--- uppsrc/Core/Sort.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/uppsrc/Core/Range.h b/uppsrc/Core/Range.h index 7b2d49b00..eb4a2b801 100644 --- a/uppsrc/Core/Range.h +++ b/uppsrc/Core/Range.h @@ -1,5 +1,5 @@ template -using ValueTypeOf = typename std::remove_referencebegin())>::type; +using ValueTypeOf = typename std::remove_reference::type *)0)->begin())>::type; template using IteratorOf = decltype(((Range *)0)->begin()); @@ -47,13 +47,13 @@ SubRangeClass SubRange(I l, int count) { return SubRangeClass(l, count); } - +/* template auto SubRange(C& c, int pos, int count) -> decltype(SubRange(c.begin() + pos, count)) { return SubRange(c.begin() + pos, count); } - +*/ template auto SubRange(C&& c, int pos, int count) -> decltype(SubRange(c.begin() + pos, count)) { diff --git a/uppsrc/Core/Sort.h b/uppsrc/Core/Sort.h index 15d140116..3781cd1f5 100644 --- a/uppsrc/Core/Sort.h +++ b/uppsrc/Core/Sort.h @@ -116,14 +116,14 @@ template void Sort(Range&& c, const Less& less) { Sort(c, less); } template -void Sort(Range& c) +void Sort(Range&& c) { Sort__(c.begin(), c.end(), std::less>()); } - +/* template -void Sort(Range&& c) { Sort(c); } - +void Sort(Range& c) { Sort(c); } +*/ template struct StableSortItem__ { const T& value;