Topic: Proposal. Generators of numeric sequences: the


Author: Douglas Boffey <douglas.boffey@gmail.com>
Date: Sat, 28 Jun 2014 10:40:22 -0700 (PDT)
Raw View
------=_Part_1167_27525676.1403977223096
Content-Type: text/plain; charset=UTF-8



>
> A function makes_steps, which has the following three overloaded formats:
>
> makes_steps(start, finish, step)
>
> make_steps(start, finish) // step = 1
>
> make_steps(finish) // start = 0; step = 1
>
>
> Is the function makes_steps or make_steps?

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_1167_27525676.1403977223096
Content-Type: text/html; charset=UTF-8

<div dir="ltr"><br><blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir="ltr"><br><p class="MsoNormal">A function <span class="QuoteChar"><span style="font-size:
11.0pt;line-height:115%">makes_steps, </span></span>which has the following
three overloaded formats:</p>

<p class="MsoQuote">makes_steps(start, finish, step)</p>

<p class="MsoQuote">make_steps(start, finish) // step = 1</p>

<p class="MsoQuote">make_steps(finish) // start = 0; step = 1</p>

<div><br></div><div><br></div></div></blockquote><div>Is the function makes_steps or make_steps? <br></div></div>

<p></p>

-- <br />
<br />
--- <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 email to <a href="mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href="mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />

------=_Part_1167_27525676.1403977223096--

.


Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Sat, 28 Jun 2014 11:02:41 -0700 (PDT)
Raw View
------=_Part_392_12456432.1403978561850
Content-Type: text/plain; charset=UTF-8



On Saturday, June 28, 2014 6:40:23 PM UTC+1, Douglas Boffey wrote:
>
>
>
>> A function makes_steps, which has the following three overloaded formats:
>>
>> makes_steps(start, finish, step)
>>
>> make_steps(start, finish) // step = 1
>>
>> make_steps(finish) // start = 0; step = 1
>>
>>
Thank you for spotting that. I have corrected it; the link stays the same.


--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_392_12456432.1403978561850
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Saturday, June 28, 2014 6:40:23 PM UTC+1, Dougl=
as Boffey wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px =
0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border=
-left-width: 1px; border-left-style: solid;"><div dir=3D"ltr"><br><blockquo=
te class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: =
1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-=
left-style: solid;"><div dir=3D"ltr"><br><p class=3D"MsoNormal">A function =
<span><span style=3D"line-height: 115%; font-size: 11pt;">makes_steps, </sp=
an></span>which has the following
three overloaded formats:</p>

<p>makes_steps(start, finish, step)</p>

<p>make_steps(start, finish) // step =3D 1</p>

<p>make_steps(finish) // start =3D 0; step =3D 1</p>

<div><br></div></div></blockquote></div></blockquote><div><br></div><div>Th=
ank you for spotting that. I have corrected it; the link stays the same.</d=
iv><div>&nbsp;</div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_392_12456432.1403978561850--

.


Author: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@gmail.com>
Date: Sat, 28 Jun 2014 21:03:28 +0200
Raw View
2014-06-28 17:50 GMT+02:00 Mikhail Semenov <mikhailsemenov1957@gmail.com>:
> https://dl.dropboxusercontent.com/u/35715999/steps_template.htm
>
> I have change the implementation of the original proposal, which allowed to
> use the steps<T> class only in a for-loop.
> In brief, the idea is to create iterators that can generate sequences (in
> contrast iterators based on containers).
> There are two types of generators:
>
> (1) with a fixed step;
> (2) base on a function whose parameter changes within a give range.
>
> Such objects don't occupy much space but can be used to generate long
> sequences. Such iterators can be used for fill containers and also in
> for-loops. They can also be used with other STL functions that involve
> iterators.

Hi Mikhail,

1) Please address "Library Evolution Working Group" instead of
"Library Working Group" in the project description

2) When reading the proposal your notation forms that describe *class
templates*, such as

steps <T>(T start, T finish, step_type step = 1)

steps<T(FunctionType)>(FunctionType f, T left, T right, step_type step)

confused me. Maybe you present a normal class template
(specialization) that doesn't mention anything but the constructor
that you want to explain here such as:

template<class T>
class steps {
  [..]
  [..]
};

3) In Proposed Wording, there are some odd line breaks and typos(?):
Are you sure about a member "range" or should this be the "step"
constructor?

- "Type T is and arithmetic type." This seems to intend a precondition
imposed on users. In this case you need to say "shall be" instead.
Violating this causes UB, so you may want to consider to require a
diagnostics. Doing so could be done by wording along the lines of:

"If the primary template of class template step is instantiated with a
type that is not an arithmetic type for the template parameter T, the
program is ill-formed."

- "unspecified& begin();" (and similarly for end):

Is the ambersand intended and should this really mean that the
function returns a reference to some other type?

Is the omission of const intended for begin()/end()?

Is the omission of noexcept for begin()/end() intended, can these
functions throw exceptions?

Is the omission of providing a member typedef for T (for the primary
template) intended?

"unspecified" is underspecified, especially when you later say "whose
iterators". I recommend at least something like

see below begin();

and following the class template synopsis you provide further
specification (but see below)

Personally I would prefer to have a member type "iterator", because
otherwise the specification is now unclear whether begin() and end()
may return different types.

using iterator = /implementation-defined/;

iterator begin();
iterator end();

then:

Member type iterator is an constant iterator satisfying all the
requirements of a <fill here the guaranteed iterator category>
iterator.

"generate the following sequences" is somehow misleading, because this
could be read as if your class steps would hold real elements that are
"generated". You should better start along the lines of:

An object of type iterator represents an iterator for a sequence of T elements.

Following that you need to specify the begin and the end of that
sequence and you need to make clear that begin() returns the iterator
to the first element of this sequence and what end() means etc. The
wording should be formed in a way that refers to the value of the i-th
element of the sequence and should not focus on the number of steps,
because that falls just out of the specification how the i-th element
is formed.

- In make_steps's Requires element you mention "T is the type of the
expression(left + right)" which mixes somehow requirements with
definitions. It seems you want to say (note the usage of "shall"
again):

Requires: T1, T2 and S shall be arithmetic types; The expression "left
+ right" shall be valid.

Remarks: Let T be decltype(left + right)

Again you could require a diagnostics if the second pre-condition is
not satisfied, e.g.

Requires: T1, T2 and S shall be arithmetic types.

Remarks: If the expression left + right, considered as an unevaluated
operand, is not well-formed, the program is ill-formed. Let T be
decltype(left + right).

- The make_step: What is " F is the type of a function" intended to
mean? Are you requiring real function pointers? Why not support for
any form of function objects which is what C++ usually supports
instead.

These are just some initial thoughts, I had not enough time for a more
careful review.

- Daniel

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Jim Porter <jvp4846@g.rit.edu>
Date: Sat, 28 Jun 2014 13:34:21 -0500
Raw View
On 6/28/2014 10:50 AM, Mikhail Semenov wrote:
> https://dl.dropboxusercontent.com/u/35715999/steps_template.htm

In this, you describe ways to use std::steps with floating point values,
which requires some special handling to stop the iteration if you're
within epsilon of the endpoint. However, for the floating point case,
I'd really recommend using something more like NumPy's linspace, which
takes, a start, a stop, and a *number of samples*.

Supposing we had a function like template <typename T> std::linspace(T
start, T stop, size_t num, include_endpoint = true) and a corresponding
std::make_linspace, this is how you could write your integrate function:

   double integrate(
     std::function<double(double)> f, double a, double b, int N
   ) {
     double h = (b - a) / N;
     double h2 = h * 0.5;
     double sum = 0.0;

     for(auto x : std::make_linspace(a + h2, b - h2, N)) {
       sum += f(x);
     }

     return sum * h;
   }

This allows you to avoid worrying about how to define epsilon so that
you're guaranteed to get the number of steps you expect. The extra
complexity for the user is minimal, and makes it clearer that you expect
N steps. If you cared less about efficiency, you could make the loop
look even simpler:

     for(auto x : std::make_linspace(a, b, N, false)) {
       sum += f(x + h2);
     }

Even with the epsilon calculation for std::steps, I'd still be worried
about using it if I expected a particular number of iteration steps, and
if that number were quite large. std::linspace would have no such trouble.

- Jim

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Sat, 28 Jun 2014 12:24:21 -0700 (PDT)
Raw View
------=_Part_1268_15043835.1403983462132
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Thank you for your comment. I am going to address the issues immediately=20
and revise the document.

On Saturday, June 28, 2014 8:03:33 PM UTC+1, Daniel Kr=C3=BCgler wrote:
>
> 2014-06-28 17:50 GMT+02:00 Mikhail Semenov <mikhailse...@gmail.com=20
> <javascript:>>:=20
> > https://dl.dropboxusercontent.com/u/35715999/steps_template.htm=20
> >=20
> > I have change the implementation of the original proposal, which allowe=
d=20
> to=20
> > use the steps<T> class only in a for-loop.=20
> > In brief, the idea is to create iterators that can generate sequences=
=20
> (in=20
> > contrast iterators based on containers).=20
> > There are two types of generators:=20
> >=20
> > (1) with a fixed step;=20
> > (2) base on a function whose parameter changes within a give range.=20
> >=20
> > Such objects don't occupy much space but can be used to generate long=
=20
> > sequences. Such iterators can be used for fill containers and also in=
=20
> > for-loops. They can also be used with other STL functions that involve=
=20
> > iterators.=20
>
> Hi Mikhail,=20
>
> 1) Please address "Library Evolution Working Group" instead of=20
> "Library Working Group" in the project description=20
>
> 2) When reading the proposal your notation forms that describe *class=20
> templates*, such as=20
>
> steps <T>(T start, T finish, step_type step =3D 1)=20
>
> steps<T(FunctionType)>(FunctionType f, T left, T right, step_type step)=
=20
>
> confused me. Maybe you present a normal class template=20
> (specialization) that doesn't mention anything but the constructor=20
> that you want to explain here such as:=20
>
> template<class T>=20
> class steps {=20
>   [..]=20
>   [..]=20
> };=20
>
> 3) In Proposed Wording, there are some odd line breaks and typos(?):=20
> Are you sure about a member "range" or should this be the "step"=20
> constructor?=20
>
> - "Type T is and arithmetic type." This seems to intend a precondition=20
> imposed on users. In this case you need to say "shall be" instead.=20
> Violating this causes UB, so you may want to consider to require a=20
> diagnostics. Doing so could be done by wording along the lines of:=20
>
> "If the primary template of class template step is instantiated with a=20
> type that is not an arithmetic type for the template parameter T, the=20
> program is ill-formed."=20
>
> - "unspecified& begin();" (and similarly for end):=20
>
> Is the ambersand intended and should this really mean that the=20
> function returns a reference to some other type?=20
>
> Is the omission of const intended for begin()/end()?=20
>
> Is the omission of noexcept for begin()/end() intended, can these=20
> functions throw exceptions?=20
>
> Is the omission of providing a member typedef for T (for the primary=20
> template) intended?=20
>
> "unspecified" is underspecified, especially when you later say "whose=20
> iterators". I recommend at least something like=20
>
> see below begin();=20
>
> and following the class template synopsis you provide further=20
> specification (but see below)=20
>
> Personally I would prefer to have a member type "iterator", because=20
> otherwise the specification is now unclear whether begin() and end()=20
> may return different types.=20
>
> using iterator =3D /implementation-defined/;=20
>
> iterator begin();=20
> iterator end();=20
>
> then:=20
>
> Member type iterator is an constant iterator satisfying all the=20
> requirements of a <fill here the guaranteed iterator category>=20
> iterator.=20
>
> "generate the following sequences" is somehow misleading, because this=20
> could be read as if your class steps would hold real elements that are=20
> "generated". You should better start along the lines of:=20
>
> An object of type iterator represents an iterator for a sequence of T=20
> elements.=20
>
> Following that you need to specify the begin and the end of that=20
> sequence and you need to make clear that begin() returns the iterator=20
> to the first element of this sequence and what end() means etc. The=20
> wording should be formed in a way that refers to the value of the i-th=20
> element of the sequence and should not focus on the number of steps,=20
> because that falls just out of the specification how the i-th element=20
> is formed.=20
>
> - In make_steps's Requires element you mention "T is the type of the=20
> expression(left + right)" which mixes somehow requirements with=20
> definitions. It seems you want to say (note the usage of "shall"=20
> again):=20
>
> Requires: T1, T2 and S shall be arithmetic types; The expression "left=20
> + right" shall be valid.=20
>
> Remarks: Let T be decltype(left + right)=20
>
> Again you could require a diagnostics if the second pre-condition is=20
> not satisfied, e.g.=20
>
> Requires: T1, T2 and S shall be arithmetic types.=20
>
> Remarks: If the expression left + right, considered as an unevaluated=20
> operand, is not well-formed, the program is ill-formed. Let T be=20
> decltype(left + right).=20
>
> - The make_step: What is " F is the type of a function" intended to=20
> mean? Are you requiring real function pointers? Why not support for=20
> any form of function objects which is what C++ usually supports=20
> instead.=20
>
> These are just some initial thoughts, I had not enough time for a more=20
> careful review.=20
>
> - Daniel=20
>

--=20

---=20
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 e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_1268_15043835.1403983462132
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thank you for your comment. I am going to address the issu=
es&nbsp;immediately and revise the document.<br><br>On Saturday, June 28, 2=
014 8:03:33 PM UTC+1, Daniel Kr=C3=BCgler wrote:<blockquote class=3D"gmail_=
quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-c=
olor: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;=
">2014-06-28 17:50 GMT+02:00 Mikhail Semenov &lt;<a onmousedown=3D"this.hre=
f=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:';return=
 true;" href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"-TH=
7zrjkQWEJ">mikhailse...@gmail.com</a>&gt;<wbr>:
<br>&gt; <a onmousedown=3D"this.href=3D'https://www.google.com/url?q\75http=
s%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F35715999%2Fsteps_template.htm\46s=
a\75D\46sntz\0751\46usg\75AFQjCNEHsERzK0q4Gj_XECN3wdBJ4bEutA';return true;"=
 onclick=3D"this.href=3D'https://www.google.com/url?q\75https%3A%2F%2Fdl.dr=
opboxusercontent.com%2Fu%2F35715999%2Fsteps_template.htm\46sa\75D\46sntz\07=
51\46usg\75AFQjCNEHsERzK0q4Gj_XECN3wdBJ4bEutA';return true;" href=3D"https:=
//dl.dropboxusercontent.com/u/35715999/steps_template.htm" target=3D"_blank=
">https://dl.dropboxusercontent.<wbr>com/u/35715999/steps_template.<wbr>htm=
</a>
<br>&gt;
<br>&gt; I have change the implementation of the original proposal, which a=
llowed to
<br>&gt; use the steps&lt;T&gt; class only in a for-loop.
<br>&gt; In brief, the idea is to create iterators that can generate sequen=
ces (in
<br>&gt; contrast iterators based on containers).
<br>&gt; There are two types of generators:
<br>&gt;
<br>&gt; (1) with a fixed step;
<br>&gt; (2) base on a function whose parameter changes within a give range=
..
<br>&gt;
<br>&gt; Such objects don't occupy much space but can be used to generate l=
ong
<br>&gt; sequences. Such iterators can be used for fill containers and also=
 in
<br>&gt; for-loops. They can also be used with other STL functions that inv=
olve
<br>&gt; iterators.
<br>
<br>Hi Mikhail,
<br>
<br>1) Please address "Library Evolution Working Group" instead of
<br>"Library Working Group" in the project description
<br>
<br>2) When reading the proposal your notation forms that describe *class
<br>templates*, such as
<br>
<br>steps &lt;T&gt;(T start, T finish, step_type step =3D 1)
<br>
<br>steps&lt;T(FunctionType)&gt;(<wbr>FunctionType f, T left, T right, step=
_type step)
<br>
<br>confused me. Maybe you present a normal class template
<br>(specialization) that doesn't mention anything but the constructor
<br>that you want to explain here such as:
<br>
<br>template&lt;class T&gt;
<br>class steps {
<br>&nbsp; [..]
<br>&nbsp; [..]
<br>};
<br>
<br>3) In Proposed Wording, there are some odd line breaks and typos(?):
<br>Are you sure about a member "range" or should this be the "step"
<br>constructor?
<br>
<br>- "Type T is and arithmetic type." This seems to intend a precondition
<br>imposed on users. In this case you need to say "shall be" instead.
<br>Violating this causes UB, so you may want to consider to require a
<br>diagnostics. Doing so could be done by wording along the lines of:
<br>
<br>"If the primary template of class template step is instantiated with a
<br>type that is not an arithmetic type for the template parameter T, the
<br>program is ill-formed."
<br>
<br>- "unspecified&amp; begin();" (and similarly for end):
<br>
<br>Is the ambersand intended and should this really mean that the
<br>function returns a reference to some other type?
<br>
<br>Is the omission of const intended for begin()/end()?
<br>
<br>Is the omission of noexcept for begin()/end() intended, can these
<br>functions throw exceptions?
<br>
<br>Is the omission of providing a member typedef for T (for the primary
<br>template) intended?
<br>
<br>"unspecified" is underspecified, especially when you later say "whose
<br>iterators". I recommend at least something like
<br>
<br>see below begin();
<br>
<br>and following the class template synopsis you provide further
<br>specification (but see below)
<br>
<br>Personally I would prefer to have a member type "iterator", because
<br>otherwise the specification is now unclear whether begin() and end()
<br>may return different types.
<br>
<br>using iterator =3D /implementation-defined/;
<br>
<br>iterator begin();
<br>iterator end();
<br>
<br>then:
<br>
<br>Member type iterator is an constant iterator satisfying all the
<br>requirements of a &lt;fill here the guaranteed iterator category&gt;
<br>iterator.
<br>
<br>"generate the following sequences" is somehow misleading, because this
<br>could be read as if your class steps would hold real elements that are
<br>"generated". You should better start along the lines of:
<br>
<br>An object of type iterator represents an iterator for a sequence of T e=
lements.
<br>
<br>Following that you need to specify the begin and the end of that
<br>sequence and you need to make clear that begin() returns the iterator
<br>to the first element of this sequence and what end() means etc. The
<br>wording should be formed in a way that refers to the value of the i-th
<br>element of the sequence and should not focus on the number of steps,
<br>because that falls just out of the specification how the i-th element
<br>is formed.
<br>
<br>- In make_steps's Requires element you mention "T is the type of the
<br>expression(left + right)" which mixes somehow requirements with
<br>definitions. It seems you want to say (note the usage of "shall"
<br>again):
<br>
<br>Requires: T1, T2 and S shall be arithmetic types; The expression "left
<br>+ right" shall be valid.
<br>
<br>Remarks: Let T be decltype(left + right)
<br>
<br>Again you could require a diagnostics if the second pre-condition is
<br>not satisfied, e.g.
<br>
<br>Requires: T1, T2 and S shall be arithmetic types.
<br>
<br>Remarks: If the expression left + right, considered as an unevaluated
<br>operand, is not well-formed, the program is ill-formed. Let T be
<br>decltype(left + right).
<br>
<br>- The make_step: What is " F is the type of a function" intended to
<br>mean? Are you requiring real function pointers? Why not support for
<br>any form of function objects which is what C++ usually supports
<br>instead.
<br>
<br>These are just some initial thoughts, I had not enough time for a more
<br>careful review.
<br>
<br>- Daniel
<br></blockquote></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_1268_15043835.1403983462132--

.


Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Sat, 28 Jun 2014 13:06:28 -0700 (PDT)
Raw View
------=_Part_1353_24319980.1403985989215
Content-Type: text/plain; charset=UTF-8

Jim. I was thinking about something like that:
make_table(a,b,N, upper_bound_included)
make_table(f,a,b,N, upper_bound_included)
I probably should add them to the proposal.

On Saturday, June 28, 2014 8:15:13 PM UTC+1, Jim Porter wrote:

> On 6/28/2014 10:50 AM, Mikhail Semenov wrote:
> > https://dl.dropboxusercontent.com/u/35715999/steps_template.htm
>
> In this, you describe ways to use std::steps with floating point values,
> which requires some special handling to stop the iteration if you're
> within epsilon of the endpoint. However, for the floating point case,
> I'd really recommend using something more like NumPy's linspace, which
> takes, a start, a stop, and a *number of samples*.
>
> Supposing we had a function like template <typename T> std::linspace(T
> start, T stop, size_t num, include_endpoint = true) and a corresponding
> std::make_linspace, this is how you could write your integrate function:
>
>    double integrate(
>      std::function<double(double)> f, double a, double b, int N
>    ) {
>      double h = (b - a) / N;
>      double h2 = h * 0.5;
>      double sum = 0.0;
>
>      for(auto x : std::make_linspace(a + h2, b - h2, N)) {
>        sum += f(x);
>      }
>
>      return sum * h;
>    }
>
> This allows you to avoid worrying about how to define epsilon so that
> you're guaranteed to get the number of steps you expect. The extra
> complexity for the user is minimal, and makes it clearer that you expect
> N steps. If you cared less about efficiency, you could make the loop
> look even simpler:
>
>      for(auto x : std::make_linspace(a, b, N, false)) {
>        sum += f(x + h2);
>      }
>
> Even with the epsilon calculation for std::steps, I'd still be worried
> about using it if I expected a particular number of iteration steps, and
> if that number were quite large. std::linspace would have no such trouble.
>
> - Jim
>
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_1353_24319980.1403985989215
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Jim. I was thinking about something like that:</div><=
div>make_table(a,b,N, upper_bound_included)</div><div>make_table(f,a,b,N, u=
pper_bound_included)</div><div>I probably should add them to the proposal.<=
br><br>On Saturday, June 28, 2014 8:15:13 PM UTC+1, Jim Porter wrote:</div>=
<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; paddi=
ng-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px=
; border-left-style: solid;">On 6/28/2014 10:50 AM, Mikhail Semenov wrote:
<br>&gt; <a onmousedown=3D"this.href=3D'https://www.google.com/url?q\75http=
s%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F35715999%2Fsteps_template.htm\46s=
a\75D\46sntz\0751\46usg\75AFQjCNEHsERzK0q4Gj_XECN3wdBJ4bEutA';return true;"=
 onclick=3D"this.href=3D'https://www.google.com/url?q\75https%3A%2F%2Fdl.dr=
opboxusercontent.com%2Fu%2F35715999%2Fsteps_template.htm\46sa\75D\46sntz\07=
51\46usg\75AFQjCNEHsERzK0q4Gj_XECN3wdBJ4bEutA';return true;" href=3D"https:=
//dl.dropboxusercontent.com/u/35715999/steps_template.htm" target=3D"_blank=
">https://dl.dropboxusercontent.<wbr>com/u/35715999/steps_template.<wbr>htm=
</a>
<br>
<br>In this, you describe ways to use std::steps with floating point values=
,=20
<br>which requires some special handling to stop the iteration if you're=20
<br>within epsilon of the endpoint. However, for the floating point case,=
=20
<br>I'd really recommend using something more like NumPy's linspace, which=
=20
<br>takes, a start, a stop, and a *number of samples*.
<br>
<br>Supposing we had a function like template &lt;typename T&gt; std::linsp=
ace(T=20
<br>start, T stop, size_t num, include_endpoint =3D true) and a correspondi=
ng=20
<br>std::make_linspace, this is how you could write your integrate function=
:
<br>
<br>&nbsp; &nbsp;double integrate(
<br>&nbsp; &nbsp; &nbsp;std::function&lt;double(double)&gt; f, double a, do=
uble b, int N
<br>&nbsp; &nbsp;) {
<br>&nbsp; &nbsp; &nbsp;double h =3D (b - a) / N;
<br>&nbsp; &nbsp; &nbsp;double h2 =3D h * 0.5;
<br>&nbsp; &nbsp; &nbsp;double sum =3D 0.0;
<br>
<br>&nbsp; &nbsp; &nbsp;for(auto x : std::make_linspace(a + h2, b - h2, N))=
 {
<br>&nbsp; &nbsp; &nbsp; &nbsp;sum +=3D f(x);
<br>&nbsp; &nbsp; &nbsp;}
<br>
<br>&nbsp; &nbsp; &nbsp;return sum * h;
<br>&nbsp; &nbsp;}
<br>
<br>This allows you to avoid worrying about how to define epsilon so that=
=20
<br>you're guaranteed to get the number of steps you expect. The extra=20
<br>complexity for the user is minimal, and makes it clearer that you expec=
t=20
<br>N steps. If you cared less about efficiency, you could make the loop=20
<br>look even simpler:
<br>
<br>&nbsp; &nbsp; &nbsp;for(auto x : std::make_linspace(a, b, N, false)) {
<br>&nbsp; &nbsp; &nbsp; &nbsp;sum +=3D f(x + h2);
<br>&nbsp; &nbsp; &nbsp;}
<br>
<br>Even with the epsilon calculation for std::steps, I'd still be worried=
=20
<br>about using it if I expected a particular number of iteration steps, an=
d=20
<br>if that number were quite large. std::linspace would have no such troub=
le.
<br>
<br>- Jim
<br>
<br></blockquote></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_1353_24319980.1403985989215--

.


Author: David Krauss <potswa@gmail.com>
Date: Sun, 29 Jun 2014 07:39:12 +0800
Raw View
--Apple-Mail=_B0CAFEDD-E53F-483C-99B4-65979D464235
Content-Type: text/plain; charset=ISO-8859-1


On 2014-06-28, at 11:50 PM, Mikhail Semenov <mikhailsemenov1957@gmail.com> wrote:

> https://dl.dropboxusercontent.com/u/35715999/steps_template.htm
>
> I have change the implementation of the original proposal, which allowed to use the steps<T> class only in a for-loop.

Perhaps Boost would be a better starting point?

Even if you invent something better, you'll still have to explain how it compares to Boost.

The first rule of standardization is to follow existing practice.

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--Apple-Mail=_B0CAFEDD-E53F-483C-99B4-65979D464235
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;06&ndash;28, at 11:50 PM, Mikhail Semenov &lt;<a href=3D"mailto:mikha=
ilsemenov1957@gmail.com">mikhailsemenov1957@gmail.com</a>&gt; wrote:</div><=
br class=3D"Apple-interchange-newline"><blockquote type=3D"cite"><div dir=
=3D"ltr"><div><a href=3D"https://dl.dropboxusercontent.com/u/35715999/steps=
_template.htm">https://dl.dropboxusercontent.com/u/35715999/steps_template.=
htm</a></div><div><br></div><div>I have change the implementation of the or=
iginal proposal, which allowed to use the steps&lt;T&gt; class only in a fo=
r-loop.</div></div></blockquote><br></div><div>Perhaps Boost would be a bet=
ter starting point?</div><div><br></div><div>Even if you invent something b=
etter, you&rsquo;ll still have to explain how it compares to Boost.</div><d=
iv><br></div><div>The first rule of standardization is to follow existing p=
ractice.</div><div><br></div></body></html>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_B0CAFEDD-E53F-483C-99B4-65979D464235--

.


Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Thu, 3 Jul 2014 12:59:52 -0700 (PDT)
Raw View
------=_Part_627_14917388.1404417592849
Content-Type: text/plain; charset=UTF-8

https://dl.dropboxusercontent.com/u/35715999/steps_and_subintervals.htm

I have updated the proposal. There is a new link.
The main changes are:
-- there are two templates now *steps* -- for integral values, *subintervals
-- *floating-point ones;
-- the proposed wording has been improved.

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_627_14917388.1404417592849
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><a href=3D"https://dl.dropboxusercontent.com/u/357159=
99/steps_and_subintervals.htm">https://dl.dropboxusercontent.com/u/35715999=
/steps_and_subintervals.htm</a></div><div><br></div><div>I have updated the=
 proposal. There is a new link.</div><div>The main changes are:</div><div>-=
- there are two templates now <strong>steps</strong> -- for integral values=
, <strong>subintervals -- </strong>floating-point ones;</div><div>--&nbsp;t=
he proposed&nbsp;wording has been improved.</div><div><br></div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_627_14917388.1404417592849--

.


Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Thu, 17 Jul 2014 13:07:03 -0700 (PDT)
Raw View
------=_Part_154_1841308363.1405627624054
Content-Type: text/plain; charset=UTF-8

Here is an updated proposal:

https://dl.dropboxusercontent.com/u/35715999/n_steps.htm

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_154_1841308363.1405627624054
Content-Type: text/html; charset=UTF-8

<div dir="ltr"><div>Here is an updated proposal:</div><div><br></div><div><a href="https://dl.dropboxusercontent.com/u/35715999/n_steps.htm">https://dl.dropboxusercontent.com/u/35715999/n_steps.htm</a></div><div><br></div></div>

<p></p>

-- <br />
<br />
--- <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 email to <a href="mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href="mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />

------=_Part_154_1841308363.1405627624054--

.


Author: Sean Middleditch <sean.middleditch@gmail.com>
Date: Sun, 20 Jul 2014 23:25:40 -0700 (PDT)
Raw View
------=_Part_352_1958854280.1405923940620
Content-Type: text/plain; charset=UTF-8

  template<class T> steps<T,T,int> make_steps(T c, bool ascending = true);

Using a boolean for `ascending` is a little non-ideal. Integers will
convert to bool implicitly making misuses like `make_steps(N, -2)` turn
into the unintended `make_steps(N, true)`. The use true/false also just
isn't readable in interfaces like this. An enum would be a better choice so
you'd have something like

  enum class step_direction { ascending, descending };
  template<class T> steps<T,T,int> make_steps(T c, step_direction direction
= step_direction::ascending );

  make_steps(N, step_direction::descending);

step_direction could use a less-obnoxiously-long name, but you get the
drift.

On Thursday, July 17, 2014 1:07:04 PM UTC-7, Mikhail Semenov wrote:
>
> Here is an updated proposal:
>
> https://dl.dropboxusercontent.com/u/35715999/n_steps.htm
>
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_352_1958854280.1405923940620
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><font size=3D"2" face=3D"courier new, monospace"><span sty=
le=3D"color: rgb(0, 0, 0); line-height: 18.399999618530273px; text-indent: =
-48px;"><span style=3D"background-image: initial; background-attachment: in=
itial; background-size: initial; background-origin: initial; background-cli=
p: initial; background-position: initial; background-repeat: initial;">&nbs=
p; template&lt;class&nbsp;</span></span><span style=3D"color: rgb(0, 0, 0);=
 line-height: 18.399999618530273px; text-indent: -48px;">T&gt; steps&lt;T,T=
,int&gt; make_steps(T c, bool ascending =3D true);</span></font><div><font =
size=3D"2" face=3D"courier new, monospace"><span style=3D"color: rgb(0, 0, =
0); line-height: 18.399999618530273px; text-indent: -48px;"><br></span></fo=
nt></div><div><font size=3D"2" face=3D"arial, sans-serif"><span style=3D"co=
lor: rgb(0, 0, 0); line-height: 18.399999618530273px; text-indent: -48px;">=
Using a boolean for `ascending` is a little non-ideal. Integers will conver=
t to bool implicitly making misuses like `make_steps(N, -2)` turn into the =
unintended `make_steps(N, true)`. The use true/false also just isn't readab=
le in interfaces like this. An enum would be a better choice so you'd have =
something like</span></font></div><div><font size=3D"2" face=3D"courier new=
, monospace"><span style=3D"color: rgb(0, 0, 0); line-height: 18.3999996185=
30273px; text-indent: -48px;"><br></span></font></div><div><span style=3D"c=
olor: rgb(0, 0, 0); line-height: 18.399999618530273px; text-indent: -48px; =
font-family: 'courier new', monospace; font-size: small;">&nbsp; enum class=
 step_direction { ascending, descending };</span><br></div><div><span style=
=3D"font-family: 'courier new', monospace; font-size: small; color: rgb(0, =
0, 0); line-height: 18.399999618530273px; text-indent: -48px;"><span style=
=3D"background-image: initial; background-attachment: initial; background-s=
ize: initial; background-origin: initial; background-clip: initial; backgro=
und-position: initial; background-repeat: initial;">&nbsp; template&lt;clas=
s&nbsp;</span></span><span style=3D"font-family: 'courier new', monospace; =
font-size: small; color: rgb(0, 0, 0); line-height: 18.399999618530273px; t=
ext-indent: -48px;">T&gt; steps&lt;T,T,int&gt; make_steps(T c, step_directi=
on direction =3D step_direction::ascending );</span><font size=3D"2" face=
=3D"courier new, monospace"><span style=3D"color: rgb(0, 0, 0); line-height=
: 18.399999618530273px; text-indent: -48px;"><br></span></font></div><div><=
span style=3D"font-family: 'courier new', monospace; font-size: small; colo=
r: rgb(0, 0, 0); line-height: 18.399999618530273px; text-indent: -48px;"><b=
r></span></div><div><span style=3D"font-family: 'courier new', monospace; f=
ont-size: small; color: rgb(0, 0, 0); line-height: 18.399999618530273px; te=
xt-indent: -48px;">&nbsp; make_steps(N, step_direction::descending);</span>=
</div><div><span style=3D"font-family: 'courier new', monospace; font-size:=
 small; color: rgb(0, 0, 0); line-height: 18.399999618530273px; text-indent=
: -48px;"><br></span></div><div><span style=3D"font-size: small; color: rgb=
(0, 0, 0); line-height: 18.399999618530273px; text-indent: -48px;"><font fa=
ce=3D"arial, sans-serif">step_direction could use a less-obnoxiously-long n=
ame, but you get the drift.</font></span></div><div><font size=3D"2" face=
=3D"courier new, monospace"><span style=3D"color: rgb(0, 0, 0); line-height=
: 18.399999618530273px; text-indent: -48px;"><br></span></font>On Thursday,=
 July 17, 2014 1:07:04 PM UTC-7, Mikhail Semenov wrote:<blockquote class=3D=
"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc s=
olid;padding-left: 1ex;"><div dir=3D"ltr"><div>Here is an updated proposal:=
</div><div><br></div><div><a href=3D"https://dl.dropboxusercontent.com/u/35=
715999/n_steps.htm" target=3D"_blank" onmousedown=3D"this.href=3D'https://w=
ww.google.com/url?q\75https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F3571599=
9%2Fn_steps.htm\46sa\75D\46sntz\0751\46usg\75AFQjCNHJhwMjfapN4bOOVxzCByQO8G=
EtlA';return true;" onclick=3D"this.href=3D'https://www.google.com/url?q\75=
https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F35715999%2Fn_steps.htm\46sa\7=
5D\46sntz\0751\46usg\75AFQjCNHJhwMjfapN4bOOVxzCByQO8GEtlA';return true;">ht=
tps://dl.dropboxusercontent.<wbr>com/u/35715999/n_steps.htm</a></div><div><=
br></div></div></blockquote></div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_352_1958854280.1405923940620--

.


Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Mon, 21 Jul 2014 13:45:34 -0700 (PDT)
Raw View
------=_Part_267_157772715.1405975534212
Content-Type: text/plain; charset=UTF-8

On Monday, July 21, 2014 7:25:41 AM UTC+1, Sean Middleditch wrote:
>
>   template<class T> steps<T,T,int> make_steps(T c, bool ascending = true);
>
> Using a boolean for `ascending` is a little non-ideal. Integers will
> convert to bool implicitly making misuses like `make_steps(N, -2)` turn
> into the unintended `make_steps(N, true)`. The use true/false also just
> isn't readable in interfaces like this. An enum would be a better choice so
> you'd have something like
>
>   enum class step_direction { ascending, descending };
>   template<class T> steps<T,T,int> make_steps(T c, step_direction
> direction = step_direction::ascending );
>
>   make_steps(N, step_direction::descending);
>
> step_direction could use a less-obnoxiously-long name, but you get the
> drift.
>

Thank you. I have updated the text, but with a slightly different solution:
I introduced
make_steps_backward(n).



--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_267_157772715.1405975534212
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>On Monday, July 21, 2014 7:25:41 AM UTC+1, Sean Middl=
editch wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px=
 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-le=
ft-width: 1px; border-left-style: solid;"><div dir=3D"ltr"><font face=3D"co=
urier new, monospace" size=3D"2"><span style=3D"color: rgb(0, 0, 0); line-h=
eight: 18.39px;"><span>&nbsp; template&lt;class&nbsp;</span></span><span st=
yle=3D"color: rgb(0, 0, 0); line-height: 18.39px;">T&gt; steps&lt;T,T,int&g=
t; make_steps(T c, bool ascending =3D true);</span></font><div><font face=
=3D"courier new, monospace" size=3D"2"><span style=3D"color: rgb(0, 0, 0); =
line-height: 18.39px;"><br></span></font></div><div><font face=3D"arial, sa=
ns-serif" size=3D"2"><span style=3D"color: rgb(0, 0, 0); line-height: 18.39=
px;">Using a boolean for `ascending` is a little non-ideal. Integers will c=
onvert to bool implicitly making misuses like `make_steps(N, -2)` turn into=
 the unintended `make_steps(N, true)`. The use true/false also just isn't r=
eadable in interfaces like this. An enum would be a better choice so you'd =
have something like</span></font></div><div><font face=3D"courier new, mono=
space" size=3D"2"><span style=3D"color: rgb(0, 0, 0); line-height: 18.39px;=
"><br></span></font></div><div><span style=3D'color: rgb(0, 0, 0); line-hei=
ght: 18.39px; font-family: "courier new",monospace; font-size: small;'>&nbs=
p; enum class step_direction { ascending, descending };</span><br></div><di=
v><span style=3D'color: rgb(0, 0, 0); line-height: 18.39px; font-family: "c=
ourier new",monospace; font-size: small;'><span>&nbsp; template&lt;class&nb=
sp;</span></span><span style=3D'color: rgb(0, 0, 0); line-height: 18.39px; =
font-family: "courier new",monospace; font-size: small;'>T&gt; steps&lt;T,T=
,int&gt; make_steps(T c, step_direction direction =3D step_direction::ascen=
ding );</span><font face=3D"courier new, monospace" size=3D"2"><span style=
=3D"color: rgb(0, 0, 0); line-height: 18.39px;"><br></span></font></div><di=
v><span style=3D'color: rgb(0, 0, 0); line-height: 18.39px; font-family: "c=
ourier new",monospace; font-size: small;'><br></span></div><div><span style=
=3D'color: rgb(0, 0, 0); line-height: 18.39px; font-family: "courier new",m=
onospace; font-size: small;'>&nbsp; make_steps(N, step_direction::descendin=
g);</span></div><div><span style=3D'color: rgb(0, 0, 0); line-height: 18.39=
px; font-family: "courier new",monospace; font-size: small;'><br></span></d=
iv><div><span style=3D"color: rgb(0, 0, 0); line-height: 18.39px; font-size=
: small;"><font face=3D"arial, sans-serif">step_direction could use a less-=
obnoxiously-long name, but you get the drift.</font></span></div></div></bl=
ockquote></div><div><br></div><div>Thank you. I have updated the text, but =
with a slightly different solution: I introduced </div><div>make_steps_back=
ward(n).</div><div><br></div><div><br></div><div><br></div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_267_157772715.1405975534212--

.


Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Mon, 21 Jul 2014 13:58:42 -0700 (PDT)
Raw View
------=_Part_297_112804222.1405976322430
Content-Type: text/plain; charset=UTF-8

The link is the same:
https://dl.dropboxusercontent.com/u/35715999/n_steps.htm

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_297_112804222.1405976322430
Content-Type: text/html; charset=UTF-8

<div dir="ltr"><div>The link is the same:</div><div><a href="https://dl.dropboxusercontent.com/u/35715999/n_steps.htm">https://dl.dropboxusercontent.<wbr>com/u/35715999/n_steps.htm</a><br></div></div>

<p></p>

-- <br />
<br />
--- <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 email to <a href="mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href="mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />

------=_Part_297_112804222.1405976322430--

.


Author: Sean Middleditch <sean.middleditch@gmail.com>
Date: Mon, 21 Jul 2014 16:32:49 -0700 (PDT)
Raw View
------=_Part_386_2051047242.1405985569832
Content-Type: text/plain; charset=UTF-8

On Monday, July 21, 2014 1:45:34 PM UTC-7, Mikhail Semenov wrote:
>
> Thank you. I have updated the text, but with a slightly different
> solution: I introduced
> make_steps_backward(n).
>

That works.

Being a bit (more) pedantic, the C and C++ libraries seems to prefer
"reverse" rather than "backward" (reverse iterators, strrchr,
string::rfind, etc.) and usually as a prefix. Perhaps make_reverse_steps or
make_rsteps or something like that would fit in a bit better?

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_386_2051047242.1405985569832
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Monday, July 21, 2014 1:45:34 PM UTC-7, Mikhail Semenov=
 wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.=
8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>T=
hank you. I have updated the text, but with a slightly different solution: =
I introduced<br></div><div>make_steps_backward(n).</div></div></blockquote>=
<div><br></div><div>That works.</div><div><br></div><div>Being a bit (more)=
 pedantic, the C and C++ libraries seems to prefer "reverse" rather than "b=
ackward" (reverse iterators, strrchr, string::rfind, etc.) and usually as a=
 prefix. Perhaps make_reverse_steps or make_rsteps or something like that w=
ould fit in a bit better?</div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_386_2051047242.1405985569832--

.