Topic: Add qualifier flags or tags to std::sort to hint at


Author: jrmarsha@mtu.edu
Date: Tue, 22 May 2018 07:06:17 -0700 (PDT)
Raw View
------=_Part_35291_1429165264.1526997977853
Content-Type: multipart/alternative;
 boundary="----=_Part_35292_828207067.1526997977853"

------=_Part_35292_828207067.1526997977853
Content-Type: text/plain; charset="UTF-8"

Hello all,

I've been working on sorting stuff.  I've found a few times where sorting
could be better.  These are mainly about how I prioritize execution
characteristics of sorting.  Sometimes I want memory usage to be tight,
other times I'd rather buy more RAM.  Sometimes I don't care about
subordering, and others I need a stable or suffix style sort.  I think the
sort interface ought to be extended as follows:

//Lowest memory usage of this group chosen will be used
//default left to implementers
#define CONSTANT_WORKSPACE ( 1 << 0 )
#define LOGARITHMIC_WORKSPACE ( 1 << 1 )
#define LINEAR_WORKSPACE ( 1 << 2 )
#define SUPER_LINEAR_WORKSPACE ( 1 << 3 )

//Most restrictive of this group chosen will be used
//default left to implementers
#define SEQUENTIAL_EXECUTION ( 1 << 4 )
#define ORDERED_EXECUTION ( 1 << 5 )
#define UNORDERED_EXECUTION ( 1 << 6 )

//Only one of this group may be enabled
//default to no subsequence ordering
#define STABLE_SUBSEQUENCE_ORDERING ( 1 << 8 )
#define SUFFIX_SUBSEQUENCE_ORDERING ( 1 << 9 )

template< class RandomIt >
constexpr void sort( RandomIt first, RandomIt last, const unsigned long int
ExecutionHints = 0 );

template< class RandomIt, class Compare >
constexpr void sort( RandomIt first, RandomIt last, Compare comp, const
unsigned long int ExecutionHints = 0 );

This does come off as a little C like, and doesn't fit well with the
execution policy tags.  But I'm interested in what others have to say.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/98107380-aec6-4fa3-b30e-573596ab2fc8%40isocpp.org.

------=_Part_35292_828207067.1526997977853
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hello all,</div><div><br></div><div>I&#39;ve been wor=
king on sorting=20
stuff.=C2=A0 I&#39;ve found a few times where sorting could be better.=C2=
=A0 These are
 mainly about how I prioritize execution characteristics of sorting.=C2=A0=
=20
Sometimes I want memory usage to be tight, other times I&#39;d rather buy=
=20
more RAM.=C2=A0 Sometimes I don&#39;t care about subordering, and others I =
need a
 stable or suffix style sort.=C2=A0 I think the sort interface ought to be=
=20
extended as follows:</div><div style=3D"margin-left: 40px;"><br></div><div =
style=3D"margin-left: 40px;">//Lowest memory usage of this group chosen wil=
l be used</div><div style=3D"margin-left: 40px;">//default left to implemen=
ters<br></div><div style=3D"margin-left: 40px;">#define CONSTANT_WORKSPACE =
( 1 &lt;&lt; 0 )<br></div><div style=3D"margin-left: 40px;">#define LOGARIT=
HMIC_WORKSPACE ( 1 &lt;&lt; 1 )</div><div style=3D"margin-left: 40px;">#def=
ine LINEAR_WORKSPACE ( 1 &lt;&lt; 2 )</div><div style=3D"margin-left: 40px;=
">#define SUPER_LINEAR_WORKSPACE ( 1 &lt;&lt; 3 )</div><div style=3D"margin=
-left: 40px;"><div><br></div>//Most restrictive of this group chosen will b=
e used</div><div style=3D"margin-left: 40px;">//default left to implementer=
s</div><div style=3D"margin-left: 40px;">#define SEQUENTIAL_EXECUTION ( 1 &=
lt;&lt; 4 )</div><div style=3D"margin-left: 40px;">#define ORDERED_EXECUTIO=
N  ( 1 &lt;&lt; 5 )</div><div style=3D"margin-left: 40px;">#define UNORDERE=
D_EXECUTION ( 1 &lt;&lt; 6 )</div><div style=3D"margin-left: 40px;"><div><b=
r></div>//Only one of this group may be enabled</div><div style=3D"margin-l=
eft: 40px;">//default to no subsequence ordering<br></div><div style=3D"mar=
gin-left: 40px;">#define STABLE_SUBSEQUENCE_ORDERING ( 1 &lt;&lt; 8 )</div>=
<div style=3D"margin-left: 40px;">#define SUFFIX_SUBSEQUENCE_ORDERING ( 1 &=
lt;&lt; 9 )</div><div style=3D"margin-left: 40px;"><br></div><div style=3D"=
margin-left: 40px;"><font size=3D"2"><span style=3D"font-family: arial, san=
s-serif;"><span class=3D"mw-geshi cpp source-cpp"><span class=3D"kw1">templ=
ate</span><span class=3D"sy1">&lt;</span> <span class=3D"kw1">class</span> =
RandomIt <span class=3D"sy1">&gt;</span><br>
<span class=3D"kw4">constexpr void</span> sort<span class=3D"br0">(</span> =
RandomIt first, RandomIt last, const unsigned long int ExecutionHints <span=
 class=3D"br0">=3D 0 )</span><span class=3D"sy4">;</span></span></span></fo=
nt></div><div style=3D"margin-left: 40px;"><font size=3D"2"><span style=3D"=
font-family: arial, sans-serif;"><span class=3D"mw-geshi cpp source-cpp"><s=
pan class=3D"sy4"><font size=3D"2"><span style=3D"font-family: arial, sans-=
serif;"><span class=3D"mw-geshi cpp source-cpp"></span></span></font></span=
></span></span></font><br><font size=3D"2"><span style=3D"font-family: aria=
l, sans-serif;"><span class=3D"mw-geshi cpp source-cpp"><span class=3D"sy4"=
><font size=3D"2"><span style=3D"font-family: arial, sans-serif;"><span cla=
ss=3D"mw-geshi cpp source-cpp"><span class=3D"sy4"><font size=3D"2"><span s=
tyle=3D"font-family: arial, sans-serif;"><span class=3D"mw-geshi cpp source=
-cpp"><span class=3D"kw1">template</span><span class=3D"sy1">&lt;</span> <s=
pan class=3D"kw1">class</span> RandomIt, <span class=3D"kw1">class</span> C=
ompare <span class=3D"sy1">&gt;</span><br>
<span class=3D"kw4">constexpr void</span> sort<span class=3D"br0">(</span> =
RandomIt first, RandomIt last, Compare comp</span></span></font></span></sp=
an></span></font></span></span></span></font><font size=3D"2"><span style=
=3D"font-family: arial, sans-serif;"><span class=3D"mw-geshi cpp source-cpp=
"><span class=3D"sy4"><font size=3D"2"><span style=3D"font-family: arial, s=
ans-serif;"><span class=3D"mw-geshi cpp source-cpp"><span class=3D"sy4"><fo=
nt size=3D"2"><span style=3D"font-family: arial, sans-serif;"><span class=
=3D"mw-geshi cpp source-cpp"><font size=3D"2"><span style=3D"font-family: a=
rial, sans-serif;"><span class=3D"mw-geshi cpp source-cpp">, const unsigned=
 long int ExecutionHints <span class=3D"br0">=3D 0</span></span></span></fo=
nt> <span class=3D"br0">)</span><span class=3D"sy4">;</span></span></span><=
/font></span></span></span></font></span></span></span></font></div><div st=
yle=3D"margin-left: 40px;"><font size=3D"2"><span style=3D"font-family: ari=
al, sans-serif;"><span class=3D"mw-geshi cpp source-cpp"><span class=3D"sy4=
"><br></span></span></span></font></div><font size=3D"2"><span style=3D"fon=
t-family: arial, sans-serif;"><span class=3D"mw-geshi cpp source-cpp"><span=
 class=3D"sy4">This does come off as a little C like, and doesn&#39;t fit w=
ell with the execution policy tags.=C2=A0 But I&#39;m interested in what ot=
hers have to say.<br></span></span></span></font></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/98107380-aec6-4fa3-b30e-573596ab2fc8%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/98107380-aec6-4fa3-b30e-573596ab2fc8=
%40isocpp.org</a>.<br />

------=_Part_35292_828207067.1526997977853--

------=_Part_35291_1429165264.1526997977853--

.


Author: Vishal Oza <vickoza@gmail.com>
Date: Tue, 22 May 2018 23:06:29 -0700 (PDT)
Raw View
------=_Part_25359_31851978.1527055589542
Content-Type: text/plain; charset="UTF-8"

I just was curious why not put the tag in the execution policy similar to the parallelism ts?

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/c01f412c-79aa-480e-be60-b3a04327adc1%40isocpp.org.

------=_Part_25359_31851978.1527055589542--

.