mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Universal reference for algo
git-svn-id: svn://ultimatepp.org/upp/trunk@11678 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
c60085211f
commit
7e5c6a4eb4
2 changed files with 7 additions and 7 deletions
|
|
@ -1,5 +1,5 @@
|
|||
template <class Range>
|
||||
using ValueTypeOf = typename std::remove_reference<decltype(*((Range *)0)->begin())>::type;
|
||||
using ValueTypeOf = typename std::remove_reference<decltype(*((typename std::remove_reference<Range>::type *)0)->begin())>::type;
|
||||
|
||||
template <class Range>
|
||||
using IteratorOf = decltype(((Range *)0)->begin());
|
||||
|
|
@ -47,13 +47,13 @@ SubRangeClass<I> SubRange(I l, int count)
|
|||
{
|
||||
return SubRangeClass<I>(l, count);
|
||||
}
|
||||
|
||||
/*
|
||||
template <class C>
|
||||
auto SubRange(C& c, int pos, int count) -> decltype(SubRange(c.begin() + pos, count))
|
||||
{
|
||||
return SubRange(c.begin() + pos, count);
|
||||
}
|
||||
|
||||
*/
|
||||
template <class C>
|
||||
auto SubRange(C&& c, int pos, int count) -> decltype(SubRange(c.begin() + pos, count))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -116,14 +116,14 @@ template <class Range, class Less>
|
|||
void Sort(Range&& c, const Less& less) { Sort(c, less); }
|
||||
|
||||
template <class Range>
|
||||
void Sort(Range& c)
|
||||
void Sort(Range&& c)
|
||||
{
|
||||
Sort__(c.begin(), c.end(), std::less<ValueTypeOf<Range>>());
|
||||
}
|
||||
|
||||
/*
|
||||
template <class Range>
|
||||
void Sort(Range&& c) { Sort(c); }
|
||||
|
||||
void Sort(Range& c) { Sort(c); }
|
||||
*/
|
||||
template <class T>
|
||||
struct StableSortItem__ {
|
||||
const T& value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue