Topic: pair_iterator


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Fri, 27 Sep 2013 06:49:27 -0700 (PDT)
Raw View
------=_Part_71_24330368.1380289767921
Content-Type: text/plain; charset=ISO-8859-1

Did anybody make a proposal about something as pair_iterator.

As an idea: the pair_iterator incorporates two iterators and its value_type
is std::pair<typename Iterator1::value_type, typename
Iterator2::value_type>

For example

[code]

const size_t N = 10;
int a[N], b[N], c[N], d[N];

std::generate( std::begin( a ), std::end( a ), [] { return std::rand() % N;
} );
std::generate( std::begin( b ), std::end( b ), [] { return std::rand() % N;
} );

std::transform( std::begin( a ), std::end( a ), std::begin( b ),
                        std::make_pair_iterator( c, d ),
                        std::minmax );
[/code]

Array c is filled with minimum values of elements of arrays a and b while
array d is filled with maximumj values of elements of arrays a and b.


--

---
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_71_24330368.1380289767921
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Did anybody make&nbsp;a proposal about something as p=
air_iterator.</div><div>&nbsp;</div><div>As an idea: the pair_iterator inco=
rporates two iterators and its value_type is std::pair&lt;typename Iterator=
1::value_type, typename Iterator2::value_type&gt;&nbsp; </div><div>&nbsp;</=
div><div>For example</div><div>&nbsp;</div><div>[code]</div><div>&nbsp;</di=
v><div>const size_t N =3D 10;</div><div>int a[N], b[N], c[N], d[N];</div><d=
iv>&nbsp;</div><div>std::generate( std::begin( a ), std::end( a ), [] { ret=
urn std::rand() % N; } );</div><div><div>std::generate( std::begin(&nbsp;b =
), std::end(&nbsp;b ), [] { return std::rand() % N; } );</div><div>&nbsp;</=
div><div>std::transform( std::begin( a ), std::end( a ), std::begin( b ), <=
/div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s=
td::make_pair_iterator( c, d ),</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::minmax );</div><div>[/code]</div><div>&=
nbsp;</div><div>Array c is filled with minimum values of elements of arrays=
 a and b while array d is filled with maximumj values of elements of arrays=
 a and b.</div><div>&nbsp;</div></div></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_71_24330368.1380289767921--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Fri, 27 Sep 2013 06:51:27 -0700 (PDT)
Raw View
------=_Part_7_21475933.1380289887410
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

I meant std::minmax<int>:)

=D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 17:49:27 UTC+=
4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow=20
=CE=C1=D0=C9=D3=C1=CC:

> Did anybody make a proposal about something as pair_iterator.
> =20
> As an idea: the pair_iterator incorporates two iterators and its=20
> value_type is std::pair<typename Iterator1::value_type, typename=20
> Iterator2::value_type> =20
> =20
> For example
> =20
> [code]
> =20
> const size_t N =3D 10;
> int a[N], b[N], c[N], d[N];
> =20
> std::generate( std::begin( a ), std::end( a ), [] { return std::rand() %=
=20
> N; } );
> std::generate( std::begin( b ), std::end( b ), [] { return std::rand() %=
=20
> N; } );
> =20
> std::transform( std::begin( a ), std::end( a ), std::begin( b ),=20
>                         std::make_pair_iterator( c, d ),
>                         std::minmax );
> [/code]
> =20
> Array c is filled with minimum values of elements of arrays a and b while=
=20
> array d is filled with maximumj values of elements of arrays a and b.
> =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_7_21475933.1380289887410
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I meant std::minmax&lt;int&gt;:)</div><div><br>=D0=D1=
=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013&nbsp;=C7., 17:49:27 UTC+4=
 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow =CE=C1=D0=C9=D3=C1=
=CC:</div><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"><div>Did anybody ma=
ke&nbsp;a proposal about something as pair_iterator.</div><div>&nbsp;</div>=
<div>As an idea: the pair_iterator incorporates two iterators and its value=
_type is std::pair&lt;typename Iterator1::value_type, typename Iterator2::v=
alue_type&gt;&nbsp; </div><div>&nbsp;</div><div>For example</div><div>&nbsp=
;</div><div>[code]</div><div>&nbsp;</div><div>const size_t N =3D 10;</div><=
div>int a[N], b[N], c[N], d[N];</div><div>&nbsp;</div><div>std::generate( s=
td::begin( a ), std::end( a ), [] { return std::rand() % N; } );</div><div>=
<div>std::generate( std::begin(&nbsp;b ), std::end(&nbsp;b ), [] { return s=
td::rand() % N; } );</div><div>&nbsp;</div><div>std::transform( std::begin(=
 a ), std::end( a ), std::begin( b ), </div><div>&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::make_pair_iterator( c, d ),</div=
><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::=
minmax );</div><div>[/code]</div><div>&nbsp;</div><div>Array c is filled wi=
th minimum values of elements of arrays a and b while array d is filled wit=
h maximumj values of elements of arrays a and b.</div><div>&nbsp;</div></di=
v></div></blockquote></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_7_21475933.1380289887410--

.


Author: Zhihao Yuan <zy@miator.net>
Date: Fri, 27 Sep 2013 10:03:04 -0400
Raw View
On Fri, Sep 27, 2013 at 9:49 AM, Vlad from Moscow <vlad.moscow@mail.ru> wrote:
> Did anybody make a proposal about something as pair_iterator.
>
> As an idea: the pair_iterator incorporates two iterators and its value_type
> is std::pair<typename Iterator1::value_type, typename Iterator2::value_type>
>
> For example
>
> [code]
>
> const size_t N = 10;
> int a[N], b[N], c[N], d[N];
>
> std::generate( std::begin( a ), std::end( a ), [] { return std::rand() % N;
> } );
> std::generate( std::begin( b ), std::end( b ), [] { return std::rand() % N;
> } );
>
> std::transform( std::begin( a ), std::end( a ), std::begin( b ),
>                         std::make_pair_iterator( c, d ),
>                         std::minmax );
> [/code]
>
> Array c is filled with minimum values of elements of arrays a and b while
> array d is filled with maximumj values of elements of arrays a and b.

Boost has zip_iterator

  http://www.boost.org/doc/libs/1_54_0/libs/iterator/doc/zip_iterator.html

And we shortly discussed whether we should try to standardize it.
The major blocker is the current iterator category does not allow
arbitrary proxy iterator.

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
___________________________________________________
4BSD -- http://4bsd.biz/

--

---
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: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Fri, 27 Sep 2013 07:21:42 -0700 (PDT)
Raw View
------=_Part_69_17913457.1380291702883
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

Why the pair_iterator may not have category of std::output_iterator?
=20

=D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 18:03:04 UTC+=
4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Zhihao Yuan=20
=CE=C1=D0=C9=D3=C1=CC:

> On Fri, Sep 27, 2013 at 9:49 AM, Vlad from Moscow <vlad....@mail.ru<javas=
cript:>>=20
> wrote:=20
> > Did anybody make a proposal about something as pair_iterator.=20
> >=20
> > As an idea: the pair_iterator incorporates two iterators and its=20
> value_type=20
> > is std::pair<typename Iterator1::value_type, typename=20
> Iterator2::value_type>=20
> >=20
> > For example=20
> >=20
> > [code]=20
> >=20
> > const size_t N =3D 10;=20
> > int a[N], b[N], c[N], d[N];=20
> >=20
> > std::generate( std::begin( a ), std::end( a ), [] { return std::rand() =
%=20
> N;=20
> > } );=20
> > std::generate( std::begin( b ), std::end( b ), [] { return std::rand() =
%=20
> N;=20
> > } );=20
> >=20
> > std::transform( std::begin( a ), std::end( a ), std::begin( b ),=20
> >                         std::make_pair_iterator( c, d ),=20
> >                         std::minmax );=20
> > [/code]=20
> >=20
> > Array c is filled with minimum values of elements of arrays a and b=20
> while=20
> > array d is filled with maximumj values of elements of arrays a and b.=
=20
>
> Boost has zip_iterator=20
>
>   http://www.boost.org/doc/libs/1_54_0/libs/iterator/doc/zip_iterator.htm=
l=20
>
> And we shortly discussed whether we should try to standardize it.=20
> The major blocker is the current iterator category does not allow=20
> arbitrary proxy iterator.=20
>
> --=20
> Zhihao Yuan, ID lichray=20
> The best way to predict the future is to invent it.=20
> ___________________________________________________=20
> 4BSD -- http://4bsd.biz/=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_69_17913457.1380291702883
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Why the pair_iterator may not have category of std::o=
utput_iterator?</div><div>&nbsp;</div><div><br>=D0=D1=D4=CE=C9=C3=C1, 27 =
=D3=C5=CE=D4=D1=C2=D2=D1 2013&nbsp;=C7., 18:03:04 UTC+4 =D0=CF=CC=D8=DA=CF=
=D7=C1=D4=C5=CC=D8 Zhihao Yuan =CE=C1=D0=C9=D3=C1=CC:</div><blockquote clas=
s=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; bo=
rder-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-st=
yle: solid;">On Fri, Sep 27, 2013 at 9:49 AM, Vlad from Moscow &lt;<a href=
=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"99qBlJaZLxQJ">v=
lad....@mail.ru</a>&gt; wrote:
<br>&gt; Did anybody make a proposal about something as pair_iterator.
<br>&gt;
<br>&gt; As an idea: the pair_iterator incorporates two iterators and its v=
alue_type
<br>&gt; is std::pair&lt;typename Iterator1::value_type, typename Iterator2=
::value_type&gt;
<br>&gt;
<br>&gt; For example
<br>&gt;
<br>&gt; [code]
<br>&gt;
<br>&gt; const size_t N =3D 10;
<br>&gt; int a[N], b[N], c[N], d[N];
<br>&gt;
<br>&gt; std::generate( std::begin( a ), std::end( a ), [] { return std::ra=
nd() % N;
<br>&gt; } );
<br>&gt; std::generate( std::begin( b ), std::end( b ), [] { return std::ra=
nd() % N;
<br>&gt; } );
<br>&gt;
<br>&gt; std::transform( std::begin( a ), std::end( a ), std::begin( b ),
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp; std::make_pair_iterator( c, d ),
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp; std::minmax );
<br>&gt; [/code]
<br>&gt;
<br>&gt; Array c is filled with minimum values of elements of arrays a and =
b while
<br>&gt; array d is filled with maximumj values of elements of arrays a and=
 b.
<br>
<br>Boost has zip_iterator
<br>
<br>&nbsp; <a href=3D"http://www.boost.org/doc/libs/1_54_0/libs/iterator/do=
c/zip_iterator.html" target=3D"_blank">http://www.boost.org/doc/libs/<wbr>1=
_54_0/libs/iterator/doc/zip_<wbr>iterator.html</a>
<br>
<br>And we shortly discussed whether we should try to standardize it.
<br>The major blocker is the current iterator category does not allow
<br>arbitrary proxy iterator.
<br>
<br>--=20
<br>Zhihao Yuan, ID lichray
<br>The best way to predict the future is to invent it.
<br>______________________________<wbr>_____________________
<br>4BSD -- <a href=3D"http://4bsd.biz/" target=3D"_blank">http://4bsd.biz/=
</a>
<br></blockquote></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_69_17913457.1380291702883--

.


Author: Zhihao Yuan <zy@miator.net>
Date: Fri, 27 Sep 2013 10:29:38 -0400
Raw View
On Fri, Sep 27, 2013 at 10:21 AM, Vlad from Moscow <vlad.moscow@mail.ru> wrote:
> Why the pair_iterator may not have category of std::output_iterator?

It can be either Input or Output, but it's reasonable and helpful
to make it arbitrary.

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
___________________________________________________
4BSD -- http://4bsd.biz/

--

---
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: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Fri, 27 Sep 2013 07:51:46 -0700 (PDT)
Raw View
------=_Part_5_21831593.1380293506241
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

Usually some algorithms and containers deal with pairs as shown by me in=20
the example. So if the iterator will have std::output_iterator_tag it will=
=20
be very useful.
At least I like the example of its using I showed.

=D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 18:29:38 UTC+=
4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Zhihao Yuan=20
=CE=C1=D0=C9=D3=C1=CC:

> On Fri, Sep 27, 2013 at 10:21 AM, Vlad from Moscow <vlad....@mail.ru<java=
script:>>=20
> wrote:=20
> > Why the pair_iterator may not have category of std::output_iterator?=20
>

It can be either Input or Output, but it's reasonable and helpful=20
to make it arbitrary.=20

--=20
Zhihao Yuan, ID lichray=20
The best way to predict the future is to invent it.=20
___________________________________________________=20
4BSD -- http://4bsd.biz/=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_5_21831593.1380293506241
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Usually some algorithms and containers deal with pair=
s as shown by me in the example. So if the iterator will have std::output_i=
terator_tag it will be very useful.</div><div>At least I like the example o=
f its using I showed.</div><div><br>=D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=
=D1=C2=D2=D1 2013&nbsp;=C7., 18:29:38 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=
=CC=D8 Zhihao Yuan =CE=C1=D0=C9=D3=C1=CC:</div><blockquote class=3D"gmail_q=
uote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-co=
lor: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"=
>On Fri, Sep 27, 2013 at 10:21 AM, Vlad from Moscow &lt;<a href=3D"javascri=
pt:" target=3D"_blank" gdf-obfuscated-mailto=3D"XFTY6PHUOwQJ">vlad....@mail=
..ru</a>&gt; wrote:
<br>&gt; Why the pair_iterator may not have category of std::output_iterato=
r?
<br></blockquote><div><br>It can be either Input or Output, but it's reason=
able and helpful
<br>to make it arbitrary.
<br>
<br>--=20
<br>Zhihao Yuan, ID lichray
<br>The best way to predict the future is to invent it.
<br>______________________________<wbr>_____________________
<br>4BSD -- <a href=3D"http://4bsd.biz/" target=3D"_blank">http://4bsd.biz/=
</a>
<br></div></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_5_21831593.1380293506241--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Sat, 28 Sep 2013 09:40:19 -0700 (PDT)
Raw View
------=_Part_1434_10713050.1380386419839
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

I like the idea. I will write such a proposal. This code snip looks splendi=
d
=20
[code]
=20
std::transform( std::begin( a ), std::end( a ), std::begin( b ),
                        std::make_iterator_pair( std::begin( c ),=20
std::begin( d ) ),
                        std::minmax<int> );
=20
[/code]
=20
=20

=D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 17:49:27 UTC+=
4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow=20
=CE=C1=D0=C9=D3=C1=CC:

> Did anybody make a proposal about something as pair_iterator.
> =20
> As an idea: the pair_iterator incorporates two iterators and its=20
> value_type is std::pair<typename Iterator1::value_type, typename=20
> Iterator2::value_type> =20
> =20
> For example
> =20
> [code]
> =20
> const size_t N =3D 10;
> int a[N], b[N], c[N], d[N];
> =20
> std::generate( std::begin( a ), std::end( a ), [] { return std::rand() %=
=20
> N; } );
> std::generate( std::begin( b ), std::end( b ), [] { return std::rand() %=
=20
> N; } );
> =20
> std::transform( std::begin( a ), std::end( a ), std::begin( b ),=20
>                         std::make_pair_iterator( c, d ),
>                         std::minmax );
> [/code]
> =20
> Array c is filled with minimum values of elements of arrays a and b while=
=20
> array d is filled with maximumj values of elements of arrays a and b.
> =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_1434_10713050.1380386419839
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I like the idea. I will write such a proposal. This c=
ode snip looks splendid</div><div>&nbsp;</div><div>[code]</div><div>&nbsp;<=
/div><div>std::transform( std::begin( a ), std::end( a ), std::begin( b ),<=
/div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s=
td::make_iterator_pair( std::begin( c ), std::begin( d ) ),</div><div>&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::minmax&lt;i=
nt&gt; );</div><div>&nbsp;</div><div>[/code]</div><div>&nbsp;</div><div>&nb=
sp;</div><div><br>=D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013&n=
bsp;=C7., 17:49:27 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Mos=
cow =CE=C1=D0=C9=D3=C1=CC:</div><blockquote class=3D"gmail_quote" style=3D"=
margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 2=
04, 204); border-left-width: 1px; border-left-style: solid;"><div dir=3D"lt=
r"><div>Did anybody make&nbsp;a proposal about something as pair_iterator.<=
/div><div>&nbsp;</div><div>As an idea: the pair_iterator incorporates two i=
terators and its value_type is std::pair&lt;typename Iterator1::value_type,=
 typename Iterator2::value_type&gt;&nbsp; </div><div>&nbsp;</div><div>For e=
xample</div><div>&nbsp;</div><div>[code]</div><div>&nbsp;</div><div>const s=
ize_t N =3D 10;</div><div>int a[N], b[N], c[N], d[N];</div><div>&nbsp;</div=
><div>std::generate( std::begin( a ), std::end( a ), [] { return std::rand(=
) % N; } );</div><div><div>std::generate( std::begin(&nbsp;b ), std::end(&n=
bsp;b ), [] { return std::rand() % N; } );</div><div>&nbsp;</div><div>std::=
transform( std::begin( a ), std::end( a ), std::begin( b ), </div><div>&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::make_pair_=
iterator( c, d ),</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp; std::minmax );</div><div>[/code]</div><div>&nbsp;</div><di=
v>Array c is filled with minimum values of elements of arrays a and b while=
 array d is filled with maximumj values of elements of arrays a and b.</div=
><div>&nbsp;</div></div></div></blockquote></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_1434_10713050.1380386419839--

.


Author: Nevin Liber <nevin@eviloverlord.com>
Date: Sat, 28 Sep 2013 11:58:07 -0500
Raw View
--047d7b62249a423a2004e774844e
Content-Type: text/plain; charset=ISO-8859-1

On 27 September 2013 08:49, Vlad from Moscow <vlad.moscow@mail.ru> wrote:

> As an idea: the pair_iterator incorporates two iterators and its
> value_type is std::pair<typename Iterator1::value_type, typename
> Iterator2::value_type>
>

-1.  Names are important, and "first" and "second" are bad names for the
members.

(That's my only objection at this time.)
--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

--

---
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/.

--047d7b62249a423a2004e774844e
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On 27 September 2013 08:49, Vlad from Moscow <span dir=3D"=
ltr">&lt;<a href=3D"mailto:vlad.moscow@mail.ru" target=3D"_blank">vlad.mosc=
ow@mail.ru</a>&gt;</span> wrote:<br><div class=3D"gmail_extra"><div class=
=3D"gmail_quote">

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>As an idea: the pair_i=
terator incorporates two iterators and its value_type is std::pair&lt;typen=
ame Iterator1::value_type, typename Iterator2::value_type&gt;=A0<br>

</div></div></blockquote><div><br></div><div>-1. =A0Names are important, an=
d &quot;first&quot; and &quot;second&quot; are bad names for the members.</=
div><div><br></div><div>(That&#39;s my only objection at this time.)</div>

</div>-- <br>=A0Nevin &quot;:-)&quot; Liber=A0 &lt;mailto:<a href=3D"mailto=
:nevin@eviloverlord.com" target=3D"_blank">nevin@eviloverlord.com</a>&gt;=
=A0 (847) 691-1404
</div></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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 />

--047d7b62249a423a2004e774844e--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Sat, 28 Sep 2013 10:02:35 -0700 (PDT)
Raw View
------=_Part_22_33160146.1380387755914
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

Do you want to say that names iterator_pair and make_iterator_pair are bad?=
=20
What could you suggest?

=D3=D5=C2=C2=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 20:58:07 UTC+=
4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Nevin ":-)" Liber=20
=CE=C1=D0=C9=D3=C1=CC:

> On 27 September 2013 08:49, Vlad from Moscow <vlad....@mail.ru<javascript=
:>
> > wrote:
>
>> As an idea: the pair_iterator incorporates two iterators and its=20
>> value_type is std::pair<typename Iterator1::value_type, typename=20
>> Iterator2::value_type>=20
>>
>
> -1.  Names are important, and "first" and "second" are bad names for the=
=20
> members.
>
> (That's my only objection at this time.)
> --=20
>  Nevin ":-)" Liber  <mailto:ne...@eviloverlord.com <javascript:>>  (847)=
=20
> 691-1404=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_22_33160146.1380387755914
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Do you want to say that names iterator_pair and make_=
iterator_pair are bad? What could you suggest?</div><div><br>=D3=D5=C2=C2=
=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013&nbsp;=C7., 20:58:07 UTC+4 =D0=
=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Nevin ":-)" Liber =CE=C1=D0=C9=D3=C1=CC:<=
/div><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">On 27 September 2013 08:=
49, Vlad from Moscow <span dir=3D"ltr">&lt;<a href=3D"javascript:" target=
=3D"_blank" gdf-obfuscated-mailto=3D"5Vl7mA-JpQ0J">vlad....@mail.ru</a>&gt;=
</span> wrote:<br><div><div class=3D"gmail_quote">

<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;"><div dir=3D"ltr"><div>As an idea: the pair_ite=
rator incorporates two iterators and its value_type is std::pair&lt;typenam=
e Iterator1::value_type, typename Iterator2::value_type&gt;&nbsp;<br>

</div></div></blockquote><div><br></div><div>-1. &nbsp;Names are important,=
 and "first" and "second" are bad names for the members.</div><div><br></di=
v><div>(That's my only objection at this time.)</div>

</div>-- <br>&nbsp;Nevin ":-)" Liber&nbsp; &lt;mailto:<a href=3D"javascript=
:" target=3D"_blank" gdf-obfuscated-mailto=3D"5Vl7mA-JpQ0J">ne...@eviloverl=
ord.com</a><wbr>&gt;&nbsp; (847) 691-1404
</div></div>
</blockquote></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_22_33160146.1380387755914--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Sat, 28 Sep 2013 10:06:15 -0700 (PDT)
Raw View
------=_Part_1348_30245648.1380387975942
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

Or maybe I have understood you incorrectly. Inside the iterator the both=20
iterators will be kept as std::pair<Iterator1, Iterator2> and there will be=
=20
member function named something as base() that will return this pair.

=D3=D5=C2=C2=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 21:02:35 UTC+=
4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow=20
=CE=C1=D0=C9=D3=C1=CC:

> Do you want to say that names iterator_pair and make_iterator_pair are=20
> bad? What could you suggest?
>
> =D3=D5=C2=C2=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 20:58:07 UT=
C+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Nevin ":-)"=20
> Liber =CE=C1=D0=C9=D3=C1=CC:
>
>> On 27 September 2013 08:49, Vlad from Moscow <vlad....@mail.ru> wrote:
>>
>>> As an idea: the pair_iterator incorporates two iterators and its=20
>>> value_type is std::pair<typename Iterator1::value_type, typename=20
>>> Iterator2::value_type>=20
>>>
>>
>> -1.  Names are important, and "first" and "second" are bad names for the=
=20
>> members.
>>
>> (That's my only objection at this time.)
>> --=20
>>  Nevin ":-)" Liber  <mailto:ne...@eviloverlord.com>  (847) 691-1404=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_1348_30245648.1380387975942
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Or maybe I have understood you incorrectly. Inside th=
e iterator the both iterators will be kept as std::pair&lt;Iterator1, Itera=
tor2&gt; and there will be member function named something as base() that w=
ill return this pair.</div><div><br>=D3=D5=C2=C2=CF=D4=C1, 28 =D3=C5=CE=D4=
=D1=C2=D2=D1 2013&nbsp;=C7., 21:02:35 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=
=CC=D8 Vlad from Moscow =CE=C1=D0=C9=D3=C1=CC:</div><blockquote class=3D"gm=
ail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-le=
ft-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: so=
lid;"><div dir=3D"ltr"><div>Do you want to say that names iterator_pair and=
 make_iterator_pair are bad? What could you suggest?</div><div><br>=D3=D5=
=C2=C2=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013&nbsp;=C7., 20:58:07 UTC+4=
 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Nevin ":-)" Liber =CE=C1=D0=C9=D3=C1=
=CC:</div><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">On 27 September 201=
3 08:49, Vlad from Moscow <span dir=3D"ltr">&lt;<a>vlad....@mail.ru</a>&gt;=
</span> wrote:<br><div><div class=3D"gmail_quote">

<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;"><div dir=3D"ltr"><div>As an idea: the pair_ite=
rator incorporates two iterators and its value_type is std::pair&lt;typenam=
e Iterator1::value_type, typename Iterator2::value_type&gt;&nbsp;<br>

</div></div></blockquote><div><br></div><div>-1. &nbsp;Names are important,=
 and "first" and "second" are bad names for the members.</div><div><br></di=
v><div>(That's my only objection at this time.)</div>

</div>-- <br>&nbsp;Nevin ":-)" Liber&nbsp; &lt;mailto:<a>ne...@eviloverlord=
..com</a><wbr>&gt;&nbsp; (847) 691-1404
</div></div>
</blockquote></div></blockquote></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_1348_30245648.1380387975942--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Sat, 28 Sep 2013 11:54:24 -0700 (PDT)
Raw View
------=_Part_132_21485184.1380394464693
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

Here is an outline of the iterator definition
=20
[code]
namespace std
{
template <class Iterator1, class Iterator2>
class iterator_pair : public iterator<output_iterator_tag, void, void,=20
void, void>=20
{
public:
 typedef pair<Iterator1, Iterator2> iterator_type;
 iterator_pair( Iterator1, Iterator2 );
 iterator_pair( pair<Iterator1, Iterator2> );
 iterator_type base() const;
=20
 iterator_pair<Iterator1, Iterator2> &
 operator =3D( const pair<typename iterator_traits<Iterator1>::value_type,
                        typename iterator_traits<Iterator2>::value_type> &=
=20
);
 iterator_pair<Iterator1, Iterator2> &
 operator =3D( pair<typename iterator_traits<Iterator1>::value_type,
                     typename iterator_traits<Iterator2>::value_type> && );
 iterator_pair<Iterator1, Iterator2> & operator *();
 iterator_pair<Iterator1, Iterator2> & operator ++();
 iterator_pair<Iterator1, Iterator2>   operator ++( int );
protected:
 iterator_type it;
};
template <class Iterator1, class Iterator2>
iterator_pair<Iterator1, Iterator2> make_iterator_pair( Iterator1,=20
Iterator2 );
template <class Iterator1, class Iterator2>
iterator_pair<Iterator1, Iterator2> make_iterator_pair( pair<Iterator1,=20
Iterator2> );
}
[/code]
=20

=D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 17:49:27 UTC+=
4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow=20
=CE=C1=D0=C9=D3=C1=CC:

> Did anybody make a proposal about something as pair_iterator.
> =20
> As an idea: the pair_iterator incorporates two iterators and its=20
> value_type is std::pair<typename Iterator1::value_type, typename=20
> Iterator2::value_type> =20
> =20
> For example
> =20
> [code]
> =20
> const size_t N =3D 10;
> int a[N], b[N], c[N], d[N];
> =20
> std::generate( std::begin( a ), std::end( a ), [] { return std::rand() %=
=20
> N; } );
> std::generate( std::begin( b ), std::end( b ), [] { return std::rand() %=
=20
> N; } );
> =20
> std::transform( std::begin( a ), std::end( a ), std::begin( b ),=20
>                         std::make_pair_iterator( c, d ),
>                         std::minmax );
> [/code]
> =20
> Array c is filled with minimum values of elements of arrays a and b while=
=20
> array d is filled with maximumj values of elements of arrays a and b.
>
=20

> Any feedback is appreciated.=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_132_21485184.1380394464693
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Here is&nbsp;an outline of the iterator definition</d=
iv><div>&nbsp;</div><div>[code]</div><div>namespace std<br>{</div><div>temp=
late &lt;class Iterator1, class Iterator2&gt;</div><div>class iterator_pair=
 : public iterator&lt;output_iterator_tag, void, void, void, void&gt; <br>{=
<br>public:<br>&nbsp;typedef pair&lt;Iterator1, Iterator2&gt;&nbsp;iterator=
_type;</div><div>&nbsp;iterator_pair( Iterator1, Iterator2 );<br>&nbsp;iter=
ator_pair( pair&lt;Iterator1, Iterator2&gt; );</div><div>&nbsp;iterator_typ=
e base() const;<br>&nbsp;<br>&nbsp;iterator_pair&lt;Iterator1, Iterator2&gt=
; &amp;<br>&nbsp;operator =3D( const pair&lt;typename iterator_traits&lt;It=
erator1&gt;::value_type,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp; typename iterator_traits&lt;Iterator2&gt;::value_type&gt; =
&amp; );</div><div>&nbsp;iterator_pair&lt;Iterator1, Iterator2&gt; &amp;<br=
>&nbsp;operator =3D( pair&lt;typename iterator_traits&lt;Iterator1&gt;::val=
ue_type,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typename iterator=
_traits&lt;Iterator2&gt;::value_type&gt; &amp;&amp; );</div><div>&nbsp;iter=
ator_pair&lt;Iterator1, Iterator2&gt; &amp; operator *();<br>&nbsp;iterator=
_pair&lt;Iterator1, Iterator2&gt; &amp; operator ++();<br>&nbsp;iterator_pa=
ir&lt;Iterator1, Iterator2&gt;&nbsp;&nbsp; operator ++( int );</div><div>pr=
otected:<br>&nbsp;iterator_type it;<br>};</div><div>template &lt;class Iter=
ator1, class Iterator2&gt;<br>iterator_pair&lt;Iterator1, Iterator2&gt; mak=
e_iterator_pair( Iterator1, Iterator2 );</div><div>template &lt;class Itera=
tor1, class Iterator2&gt;<br>iterator_pair&lt;Iterator1, Iterator2&gt; make=
_iterator_pair( pair&lt;Iterator1, Iterator2&gt; );</div><div>}<br></div><d=
iv>[/code]</div><div>&nbsp;</div><div><br>=D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=
=CE=D4=D1=C2=D2=D1 2013&nbsp;=C7., 17:49:27 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=
=D4=C5=CC=D8 Vlad from Moscow =CE=C1=D0=C9=D3=C1=CC:</div><blockquote class=
=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; bor=
der-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-sty=
le: solid;"><div dir=3D"ltr"><div>Did anybody make&nbsp;a proposal about so=
mething as pair_iterator.</div><div>&nbsp;</div><div>As an idea: the pair_i=
terator incorporates two iterators and its value_type is std::pair&lt;typen=
ame Iterator1::value_type, typename Iterator2::value_type&gt;&nbsp; </div><=
div>&nbsp;</div><div>For example</div><div>&nbsp;</div><div>[code]</div><di=
v>&nbsp;</div><div>const size_t N =3D 10;</div><div>int a[N], b[N], c[N], d=
[N];</div><div>&nbsp;</div><div>std::generate( std::begin( a ), std::end( a=
 ), [] { return std::rand() % N; } );</div><div><div>std::generate( std::be=
gin(&nbsp;b ), std::end(&nbsp;b ), [] { return std::rand() % N; } );</div><=
div>&nbsp;</div><div>std::transform( std::begin( a ), std::end( a ), std::b=
egin( b ), </div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; std::make_pair_iterator( c, d ),</div><div>&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::minmax );</div><div>[/code]=
</div><div>&nbsp;</div><div>Array c is filled with minimum values of elemen=
ts of arrays a and b while array d is filled with maximumj values of elemen=
ts of arrays a and b.</div><div></div></div></div></blockquote><div>&nbsp;<=
/div><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"><div><div>Any feedback i=
s appreciated.&nbsp;</div></div></div></blockquote></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_132_21485184.1380394464693--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Sat, 28 Sep 2013 12:47:28 -0700 (PDT)
Raw View
------=_Part_204_1126665.1380397648384
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

=20
The constructor with the parameter std::pair is declared as explicir that i=
s
=20
explicit  iterator_pair( pair<Iterator1, Iterator2> );
=20
Also it will be better if the parameter will passed by reference
=20
explicit  iterator_pair( const pair<Iterator1, Iterator2> & );
=20

=D3=D5=C2=C2=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 22:54:24 UTC+=
4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow=20
=CE=C1=D0=C9=D3=C1=CC:

> Here is an outline of the iterator definition
> =20
> [code]
> namespace std
> {
> template <class Iterator1, class Iterator2>
> class iterator_pair : public iterator<output_iterator_tag, void, void,=20
> void, void>=20
> {
> public:
>  typedef pair<Iterator1, Iterator2> iterator_type;
>  iterator_pair( Iterator1, Iterator2 );
>  iterator_pair( pair<Iterator1, Iterator2> );
>  iterator_type base() const;
> =20
>  iterator_pair<Iterator1, Iterator2> &
>  operator =3D( const pair<typename iterator_traits<Iterator1>::value_type=
,
>                         typename iterator_traits<Iterator2>::value_type> =
&=20
> );
>  iterator_pair<Iterator1, Iterator2> &
>  operator =3D( pair<typename iterator_traits<Iterator1>::value_type,
>                      typename iterator_traits<Iterator2>::value_type> && =
);
>  iterator_pair<Iterator1, Iterator2> & operator *();
>  iterator_pair<Iterator1, Iterator2> & operator ++();
>  iterator_pair<Iterator1, Iterator2>   operator ++( int );
> protected:
>  iterator_type it;
> };
> template <class Iterator1, class Iterator2>
> iterator_pair<Iterator1, Iterator2> make_iterator_pair( Iterator1,=20
> Iterator2 );
> template <class Iterator1, class Iterator2>
> iterator_pair<Iterator1, Iterator2> make_iterator_pair( pair<Iterator1,=
=20
> Iterator2> );
> }
> [/code]
> =20
>
> =D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 17:49:27 UT=
C+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow=20
> =CE=C1=D0=C9=D3=C1=CC:
>
>> Did anybody make a proposal about something as pair_iterator.
>> =20
>> As an idea: the pair_iterator incorporates two iterators and its=20
>> value_type is std::pair<typename Iterator1::value_type, typename=20
>> Iterator2::value_type> =20
>> =20
>> For example
>> =20
>> [code]
>> =20
>> const size_t N =3D 10;
>> int a[N], b[N], c[N], d[N];
>> =20
>> std::generate( std::begin( a ), std::end( a ), [] { return std::rand() %=
=20
>> N; } );
>> std::generate( std::begin( b ), std::end( b ), [] { return std::rand() %=
=20
>> N; } );
>> =20
>> std::transform( std::begin( a ), std::end( a ), std::begin( b ),=20
>>                         std::make_pair_iterator( c, d ),
>>                         std::minmax );
>> [/code]
>> =20
>> Array c is filled with minimum values of elements of arrays a and b whil=
e=20
>> array d is filled with maximumj values of elements of arrays a and b.
>>
> =20
>
>> Any feedback is appreciated.=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_204_1126665.1380397648384
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>&nbsp;</div><div>The constructor with the parameter s=
td::pair is declared as explicir that is</div><div>&nbsp;</div><div>explici=
t &nbsp;iterator_pair( pair&lt;Iterator1, Iterator2&gt; );</div><div>&nbsp;=
</div><div>Also it will be better if the parameter will passed by reference=
</div><div>&nbsp;</div><div><div>explicit &nbsp;iterator_pair( const pair&l=
t;Iterator1, Iterator2&gt; &amp; );</div></div><div>&nbsp;</div><div><br>=
=D3=D5=C2=C2=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013&nbsp;=C7., 22:54:24=
 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow =CE=C1=D0=C9=
=D3=C1=CC:</div><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"><div>Here is&=
nbsp;an outline of the iterator definition</div><div>&nbsp;</div><div>[code=
]</div><div>namespace std<br>{</div><div>template &lt;class Iterator1, clas=
s Iterator2&gt;</div><div>class iterator_pair : public iterator&lt;output_i=
terator_tag, void, void, void, void&gt; <br>{<br>public:<br>&nbsp;typedef p=
air&lt;Iterator1, Iterator2&gt;&nbsp;iterator_type;</div><div>&nbsp;iterato=
r_pair( Iterator1, Iterator2 );<br>&nbsp;iterator_pair( pair&lt;Iterator1, =
Iterator2&gt; );</div><div>&nbsp;iterator_type base() const;<br>&nbsp;<br>&=
nbsp;iterator_pair&lt;Iterator1, Iterator2&gt; &amp;<br>&nbsp;operator =3D(=
 const pair&lt;typename iterator_traits&lt;Iterator1&gt;::<wbr>value_type,<=
br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typename=
 iterator_traits&lt;Iterator2&gt;::<wbr>value_type&gt; &amp; );</div><div>&=
nbsp;iterator_pair&lt;Iterator1, Iterator2&gt; &amp;<br>&nbsp;operator =3D(=
 pair&lt;typename iterator_traits&lt;Iterator1&gt;::<wbr>value_type,<br>&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typename iterator_traits&lt;Iter=
ator2&gt;::<wbr>value_type&gt; &amp;&amp; );</div><div>&nbsp;iterator_pair&=
lt;Iterator1, Iterator2&gt; &amp; operator *();<br>&nbsp;iterator_pair&lt;I=
terator1, Iterator2&gt; &amp; operator ++();<br>&nbsp;iterator_pair&lt;Iter=
ator1, Iterator2&gt;&nbsp;&nbsp; operator ++( int );</div><div>protected:<b=
r>&nbsp;iterator_type it;<br>};</div><div>template &lt;class Iterator1, cla=
ss Iterator2&gt;<br>iterator_pair&lt;Iterator1, Iterator2&gt; make_iterator=
_pair( Iterator1, Iterator2 );</div><div>template &lt;class Iterator1, clas=
s Iterator2&gt;<br>iterator_pair&lt;Iterator1, Iterator2&gt; make_iterator_=
pair( pair&lt;Iterator1, Iterator2&gt; );</div><div>}<br></div><div>[/code]=
</div><div>&nbsp;</div><div><br>=D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=
=C2=D2=D1 2013&nbsp;=C7., 17:49:27 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=
=D8 Vlad from Moscow =CE=C1=D0=C9=D3=C1=CC:</div><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"><div>Did anybody make&nbsp;a proposal about something a=
s pair_iterator.</div><div>&nbsp;</div><div>As an idea: the pair_iterator i=
ncorporates two iterators and its value_type is std::pair&lt;typename Itera=
tor1::value_type, typename Iterator2::value_type&gt;&nbsp; </div><div>&nbsp=
;</div><div>For example</div><div>&nbsp;</div><div>[code]</div><div>&nbsp;<=
/div><div>const size_t N =3D 10;</div><div>int a[N], b[N], c[N], d[N];</div=
><div>&nbsp;</div><div>std::generate( std::begin( a ), std::end( a ), [] { =
return std::rand() % N; } );</div><div><div>std::generate( std::begin(&nbsp=
;b ), std::end(&nbsp;b ), [] { return std::rand() % N; } );</div><div>&nbsp=
;</div><div>std::transform( std::begin( a ), std::end( a ), std::begin( b )=
, </div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; std::make_pair_iterator( c, d ),</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::minmax );</div><div>[/code]</div><di=
v>&nbsp;</div><div>Array c is filled with minimum values of elements of arr=
ays a and b while array d is filled with maximumj values of elements of arr=
ays a and b.</div><div></div></div></div></blockquote><div>&nbsp;</div><blo=
ckquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-l=
eft: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; bo=
rder-left-style: solid;"><div dir=3D"ltr"><div><div>Any feedback is appreci=
ated.&nbsp;</div></div></div></blockquote></div></blockquote></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_204_1126665.1380397648384--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Sat, 28 Sep 2013 13:30:33 -0700 (PDT)
Raw View
------=_Part_196_31309966.1380400233281
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

With this iterator containers can be changed in place. That is for example =
=20
the code snippet for arrays a, b, c and d can be executed only for arrays a=
=20
and b. Array a will contain minimal values of the two arrays while array b=
=20
will contain maximum values of the two arrays
=20
[code]
=20
std::transform( std::begin( a ), std::end( a ), std::begin( b ),
                        std::make_iterator_pair( std::begin( *a* ),=20
std::begin( *b* ) ),
                        std::minmax<int> );
=20
[/code]
=20

=D3=D5=C2=C2=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 23:47:28 UTC+=
4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow=20
=CE=C1=D0=C9=D3=C1=CC:

> =20
> The constructor with the parameter std::pair is declared as explicir that=
=20
> is
> =20
> explicit  iterator_pair( pair<Iterator1, Iterator2> );
> =20
> Also it will be better if the parameter will passed by reference
> =20
> explicit  iterator_pair( const pair<Iterator1, Iterator2> & );
> =20
>
> =D3=D5=C2=C2=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 22:54:24 UT=
C+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow=20
> =CE=C1=D0=C9=D3=C1=CC:
>
>> Here is an outline of the iterator definition
>> =20
>> [code]
>> namespace std
>> {
>> template <class Iterator1, class Iterator2>
>> class iterator_pair : public iterator<output_iterator_tag, void, void,=
=20
>> void, void>=20
>> {
>> public:
>>  typedef pair<Iterator1, Iterator2> iterator_type;
>>  iterator_pair( Iterator1, Iterator2 );
>>  iterator_pair( pair<Iterator1, Iterator2> );
>>  iterator_type base() const;
>> =20
>>  iterator_pair<Iterator1, Iterator2> &
>>  operator =3D( const pair<typename iterator_traits<Iterator1>::value_typ=
e,
>>                         typename iterator_traits<Iterator2>::value_type>=
=20
>> & );
>>  iterator_pair<Iterator1, Iterator2> &
>>  operator =3D( pair<typename iterator_traits<Iterator1>::value_type,
>>                      typename iterator_traits<Iterator2>::value_type> &&=
=20
>> );
>>  iterator_pair<Iterator1, Iterator2> & operator *();
>>  iterator_pair<Iterator1, Iterator2> & operator ++();
>>  iterator_pair<Iterator1, Iterator2>   operator ++( int );
>> protected:
>>  iterator_type it;
>> };
>> template <class Iterator1, class Iterator2>
>> iterator_pair<Iterator1, Iterator2> make_iterator_pair( Iterator1,=20
>> Iterator2 );
>> template <class Iterator1, class Iterator2>
>> iterator_pair<Iterator1, Iterator2> make_iterator_pair( pair<Iterator1,=
=20
>> Iterator2> );
>> }
>> [/code]
>> =20
>>
>> =D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 17:49:27 U=
TC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from=20
>> Moscow =CE=C1=D0=C9=D3=C1=CC:
>>
>>> Did anybody make a proposal about something as pair_iterator.
>>> =20
>>> As an idea: the pair_iterator incorporates two iterators and its=20
>>> value_type is std::pair<typename Iterator1::value_type, typename=20
>>> Iterator2::value_type> =20
>>> =20
>>> For example
>>> =20
>>> [code]
>>> =20
>>> const size_t N =3D 10;
>>> int a[N], b[N], c[N], d[N];
>>> =20
>>> std::generate( std::begin( a ), std::end( a ), [] { return std::rand() =
%=20
>>> N; } );
>>> std::generate( std::begin( b ), std::end( b ), [] { return std::rand() =
%=20
>>> N; } );
>>> =20
>>> std::transform( std::begin( a ), std::end( a ), std::begin( b ),=20
>>>                         std::make_pair_iterator( c, d ),
>>>                         std::minmax );
>>> [/code]
>>> =20
>>> Array c is filled with minimum values of elements of arrays a and b=20
>>> while array d is filled with maximumj values of elements of arrays a an=
d b.
>>>
>> =20
>>
>>> Any feedback is appreciated.=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_196_31309966.1380400233281
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>With this iterator containers can be changed in place=
.. That is for example&nbsp; the code snippet for arrays a, b, c and d can b=
e executed only for arrays a and b. Array a will contain minimal values of =
the two arrays while array b will contain maximum values of the two arrays<=
/div><div>&nbsp;</div><div><div>[code]</div><div class=3D"GJHYW0UCPEB"><div=
>&nbsp;</div><div>std::transform( std::begin( a ), std::end( a ), std::begi=
n( b ),</div></div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp; std::make_iterator_pair( std::begin(&nbsp;<strong>a</strong> )=
, std::begin(&nbsp;<strong>b</strong> ) ),</div><div>&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::minmax&lt;int&gt; );</div><d=
iv>&nbsp;</div><div>[/code]</div></div><div>&nbsp;</div><div><br>=D3=D5=C2=
=C2=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013&nbsp;=C7., 23:47:28 UTC+4 =
=D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow =CE=C1=D0=C9=D3=C1=CC=
:</div><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-wid=
th: 1px; border-left-style: solid;"><div dir=3D"ltr"><div>&nbsp;</div><div>=
The constructor with the parameter std::pair is declared as explicir that i=
s</div><div>&nbsp;</div><div>explicit &nbsp;iterator_pair( pair&lt;Iterator=
1, Iterator2&gt; );</div><div>&nbsp;</div><div>Also it will be better if th=
e parameter will passed by reference</div><div>&nbsp;</div><div><div>explic=
it &nbsp;iterator_pair( const pair&lt;Iterator1, Iterator2&gt; &amp; );</di=
v></div><div>&nbsp;</div><div><br>=D3=D5=C2=C2=CF=D4=C1, 28 =D3=C5=CE=D4=D1=
=C2=D2=D1 2013&nbsp;=C7., 22:54:24 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=
=D8 Vlad from Moscow =CE=C1=D0=C9=D3=C1=CC:</div><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"><div>Here is&nbsp;an outline of the iterator definition=
</div><div>&nbsp;</div><div>[code]</div><div>namespace std<br>{</div><div>t=
emplate &lt;class Iterator1, class Iterator2&gt;</div><div>class iterator_p=
air : public iterator&lt;output_iterator_tag, void, void, void, void&gt; <b=
r>{<br>public:<br>&nbsp;typedef pair&lt;Iterator1, Iterator2&gt;&nbsp;itera=
tor_type;</div><div>&nbsp;iterator_pair( Iterator1, Iterator2 );<br>&nbsp;i=
terator_pair( pair&lt;Iterator1, Iterator2&gt; );</div><div>&nbsp;iterator_=
type base() const;<br>&nbsp;<br>&nbsp;iterator_pair&lt;Iterator1, Iterator2=
&gt; &amp;<br>&nbsp;operator =3D( const pair&lt;typename iterator_traits&lt=
;Iterator1&gt;::<wbr>value_type,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp; typename iterator_traits&lt;Iterator2&gt;::<wbr>va=
lue_type&gt; &amp; );</div><div>&nbsp;iterator_pair&lt;Iterator1, Iterator2=
&gt; &amp;<br>&nbsp;operator =3D( pair&lt;typename iterator_traits&lt;Itera=
tor1&gt;::<wbr>value_type,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 typename iterator_traits&lt;Iterator2&gt;::<wbr>value_type&gt; &amp;&amp; =
);</div><div>&nbsp;iterator_pair&lt;Iterator1, Iterator2&gt; &amp; operator=
 *();<br>&nbsp;iterator_pair&lt;Iterator1, Iterator2&gt; &amp; operator ++(=
);<br>&nbsp;iterator_pair&lt;Iterator1, Iterator2&gt;&nbsp;&nbsp; operator =
++( int );</div><div>protected:<br>&nbsp;iterator_type it;<br>};</div><div>=
template &lt;class Iterator1, class Iterator2&gt;<br>iterator_pair&lt;Itera=
tor1, Iterator2&gt; make_iterator_pair( Iterator1, Iterator2 );</div><div>t=
emplate &lt;class Iterator1, class Iterator2&gt;<br>iterator_pair&lt;Iterat=
or1, Iterator2&gt; make_iterator_pair( pair&lt;Iterator1, Iterator2&gt; );<=
/div><div>}<br></div><div>[/code]</div><div>&nbsp;</div><div><br>=D0=D1=D4=
=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013&nbsp;=C7., 17:49:27 UTC+4 =
=D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow =CE=C1=D0=C9=D3=C1=CC=
:</div><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-wid=
th: 1px; border-left-style: solid;"><div dir=3D"ltr"><div>Did anybody make&=
nbsp;a proposal about something as pair_iterator.</div><div>&nbsp;</div><di=
v>As an idea: the pair_iterator incorporates two iterators and its value_ty=
pe is std::pair&lt;typename Iterator1::value_type, typename Iterator2::valu=
e_type&gt;&nbsp; </div><div>&nbsp;</div><div>For example</div><div>&nbsp;</=
div><div>[code]</div><div>&nbsp;</div><div>const size_t N =3D 10;</div><div=
>int a[N], b[N], c[N], d[N];</div><div>&nbsp;</div><div>std::generate( std:=
:begin( a ), std::end( a ), [] { return std::rand() % N; } );</div><div><di=
v>std::generate( std::begin(&nbsp;b ), std::end(&nbsp;b ), [] { return std:=
:rand() % N; } );</div><div>&nbsp;</div><div>std::transform( std::begin( a =
), std::end( a ), std::begin( b ), </div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::make_pair_iterator( c, d ),</div><d=
iv>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::min=
max );</div><div>[/code]</div><div>&nbsp;</div><div>Array c is filled with =
minimum values of elements of arrays a and b while array d is filled with m=
aximumj values of elements of arrays a and b.</div><div></div></div></div><=
/blockquote><div>&nbsp;</div><blockquote class=3D"gmail_quote" style=3D"mar=
gin: 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">=
<div><div>Any feedback is appreciated.&nbsp;</div></div></div></blockquote>=
</div></blockquote></div></blockquote></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_196_31309966.1380400233281--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Sat, 28 Sep 2013 13:59:11 -0700 (PDT)
Raw View
------=_Part_1172_2014227.1380401951679
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

A revised version of the iterator definition
=20
[code]
namespace usr
{
template <class Iterator1, class Iterator2>
class iterator_pair : public iterator<output_iterator_tag, void, void,=20
void, void>=20
{
public:
 typedef pair<Iterator1, Iterator2> iterator_type;
 iterator_pair( Iterator1, Iterator2 );
 explicit iterator_pair( const pair<Iterator1, Iterator2> & );
 explicit iterator_pair( pair<Iterator1, Iterator2> && );
 iterator_type base() const;
=20
 iterator_pair<Iterator1, Iterator2> &
 operator =3D( const pair<typename iterator_traits<Iterator1>::value_type,
                        typename iterator_traits<Iterator2>::value_type> &=
=20
);
 iterator_pair<Iterator1, Iterator2> &
 operator =3D( pair<typename iterator_traits<Iterator1>::value_type,
                     typename iterator_traits<Iterator2>::value_type> && );
 iterator_pair<Iterator1, Iterator2> & operator *();
 iterator_pair<Iterator1, Iterator2> & operator ++();
 iterator_pair<Iterator1, Iterator2>   operator ++( int );
protected:
 iterator_type it;
};
template <class Iterator1, class Iterator2>
iterator_pair<Iterator1, Iterator2> make_iterator_pair( Iterator1,=20
Iterator2 );
template <class Iterator1, class Iterator2>
iterator_pair<Iterator1, Iterator2> make_iterator_pair( const=20
pair<Iterator1, Iterator2> & );
template <class Iterator1, class Iterator2>
iterator_pair<Iterator1, Iterator2> make_iterator_pair( pair<Iterator1,=20
Iterator2> && );
}
[/code]
=20

=D3=D5=C2=C2=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 22:54:24 UTC+=
4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow=20
=CE=C1=D0=C9=D3=C1=CC:

> Here is an outline of the iterator definition
> =20
> [code]
> namespace std
> {
> template <class Iterator1, class Iterator2>
> class iterator_pair : public iterator<output_iterator_tag, void, void,=20
> void, void>=20
> {
> public:
>  typedef pair<Iterator1, Iterator2> iterator_type;
>  iterator_pair( Iterator1, Iterator2 );
>  iterator_pair( pair<Iterator1, Iterator2> );
>  iterator_type base() const;
> =20
>  iterator_pair<Iterator1, Iterator2> &
>  operator =3D( const pair<typename iterator_traits<Iterator1>::value_type=
,
>                         typename iterator_traits<Iterator2>::value_type> =
&=20
> );
>  iterator_pair<Iterator1, Iterator2> &
>  operator =3D( pair<typename iterator_traits<Iterator1>::value_type,
>                      typename iterator_traits<Iterator2>::value_type> && =
);
>  iterator_pair<Iterator1, Iterator2> & operator *();
>  iterator_pair<Iterator1, Iterator2> & operator ++();
>  iterator_pair<Iterator1, Iterator2>   operator ++( int );
> protected:
>  iterator_type it;
> };
> template <class Iterator1, class Iterator2>
> iterator_pair<Iterator1, Iterator2> make_iterator_pair( Iterator1,=20
> Iterator2 );
> template <class Iterator1, class Iterator2>
> iterator_pair<Iterator1, Iterator2> make_iterator_pair( pair<Iterator1,=
=20
> Iterator2> );
> }
> [/code]
> =20
>
> =D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 17:49:27 UT=
C+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow=20
> =CE=C1=D0=C9=D3=C1=CC:
>
>> Did anybody make a proposal about something as pair_iterator.
>> =20
>> As an idea: the pair_iterator incorporates two iterators and its=20
>> value_type is std::pair<typename Iterator1::value_type, typename=20
>> Iterator2::value_type> =20
>> =20
>> For example
>> =20
>> [code]
>> =20
>> const size_t N =3D 10;
>> int a[N], b[N], c[N], d[N];
>> =20
>> std::generate( std::begin( a ), std::end( a ), [] { return std::rand() %=
=20
>> N; } );
>> std::generate( std::begin( b ), std::end( b ), [] { return std::rand() %=
=20
>> N; } );
>> =20
>> std::transform( std::begin( a ), std::end( a ), std::begin( b ),=20
>>                         std::make_pair_iterator( c, d ),
>>                         std::minmax );
>> [/code]
>> =20
>> Array c is filled with minimum values of elements of arrays a and b whil=
e=20
>> array d is filled with maximumj values of elements of arrays a and b.
>>
> =20
>
>> Any feedback is appreciated.=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_1172_2014227.1380401951679
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>A revised version of the iterator definition</div><di=
v>&nbsp;</div><div>[code]</div><div>namespace usr<br>{</div><div>template &=
lt;class Iterator1, class Iterator2&gt;<br>class iterator_pair : public ite=
rator&lt;output_iterator_tag, void, void, void, void&gt; <br>{<br>public:<b=
r>&nbsp;typedef pair&lt;Iterator1, Iterator2&gt;&nbsp;iterator_type;</div><=
div>&nbsp;iterator_pair( Iterator1, Iterator2 );<br>&nbsp;explicit iterator=
_pair( const pair&lt;Iterator1, Iterator2&gt; &amp; );<br>&nbsp;explicit it=
erator_pair( pair&lt;Iterator1, Iterator2&gt; &amp;&amp; );</div><div>&nbsp=
;iterator_type base() const;<br>&nbsp;<br>&nbsp;iterator_pair&lt;Iterator1,=
 Iterator2&gt; &amp;<br>&nbsp;operator =3D( const pair&lt;typename iterator=
_traits&lt;Iterator1&gt;::value_type,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typename iterator_traits&lt;Iterator2&gt;::va=
lue_type&gt; &amp; );</div><div>&nbsp;iterator_pair&lt;Iterator1, Iterator2=
&gt; &amp;<br>&nbsp;operator =3D( pair&lt;typename iterator_traits&lt;Itera=
tor1&gt;::value_type,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type=
name iterator_traits&lt;Iterator2&gt;::value_type&gt; &amp;&amp; );</div><d=
iv>&nbsp;iterator_pair&lt;Iterator1, Iterator2&gt; &amp; operator *();<br>&=
nbsp;iterator_pair&lt;Iterator1, Iterator2&gt; &amp; operator ++();<br>&nbs=
p;iterator_pair&lt;Iterator1, Iterator2&gt;&nbsp;&nbsp; operator ++( int );=
</div><div>protected:<br>&nbsp;iterator_type it;<br>};</div><div>template &=
lt;class Iterator1, class Iterator2&gt;<br>iterator_pair&lt;Iterator1, Iter=
ator2&gt; make_iterator_pair( Iterator1, Iterator2 );</div><div>template &l=
t;class Iterator1, class Iterator2&gt;<br>iterator_pair&lt;Iterator1, Itera=
tor2&gt; make_iterator_pair( const pair&lt;Iterator1, Iterator2&gt; &amp; )=
;</div><div>template &lt;class Iterator1, class Iterator2&gt;<br>iterator_p=
air&lt;Iterator1, Iterator2&gt; make_iterator_pair( pair&lt;Iterator1, Iter=
ator2&gt; &amp;&amp; );</div><div>}<br></div><div>[/code]</div><div>&nbsp;<=
/div><div><br>=D3=D5=C2=C2=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013&nbsp;=
=C7., 22:54:24 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow =
=CE=C1=D0=C9=D3=C1=CC:</div><blockquote class=3D"gmail_quote" style=3D"marg=
in: 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"><=
div>Here is&nbsp;an outline of the iterator definition</div><div>&nbsp;</di=
v><div>[code]</div><div>namespace std<br>{</div><div>template &lt;class Ite=
rator1, class Iterator2&gt;</div><div>class iterator_pair : public iterator=
&lt;output_iterator_tag, void, void, void, void&gt; <br>{<br>public:<br>&nb=
sp;typedef pair&lt;Iterator1, Iterator2&gt;&nbsp;iterator_type;</div><div>&=
nbsp;iterator_pair( Iterator1, Iterator2 );<br>&nbsp;iterator_pair( pair&lt=
;Iterator1, Iterator2&gt; );</div><div>&nbsp;iterator_type base() const;<br=
>&nbsp;<br>&nbsp;iterator_pair&lt;Iterator1, Iterator2&gt; &amp;<br>&nbsp;o=
perator =3D( const pair&lt;typename iterator_traits&lt;Iterator1&gt;::<wbr>=
value_type,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp; typename iterator_traits&lt;Iterator2&gt;::<wbr>value_type&gt; &amp; );=
</div><div>&nbsp;iterator_pair&lt;Iterator1, Iterator2&gt; &amp;<br>&nbsp;o=
perator =3D( pair&lt;typename iterator_traits&lt;Iterator1&gt;::<wbr>value_=
type,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typename iterator_tr=
aits&lt;Iterator2&gt;::<wbr>value_type&gt; &amp;&amp; );</div><div>&nbsp;it=
erator_pair&lt;Iterator1, Iterator2&gt; &amp; operator *();<br>&nbsp;iterat=
or_pair&lt;Iterator1, Iterator2&gt; &amp; operator ++();<br>&nbsp;iterator_=
pair&lt;Iterator1, Iterator2&gt;&nbsp;&nbsp; operator ++( int );</div><div>=
protected:<br>&nbsp;iterator_type it;<br>};</div><div>template &lt;class It=
erator1, class Iterator2&gt;<br>iterator_pair&lt;Iterator1, Iterator2&gt; m=
ake_iterator_pair( Iterator1, Iterator2 );</div><div>template &lt;class Ite=
rator1, class Iterator2&gt;<br>iterator_pair&lt;Iterator1, Iterator2&gt; ma=
ke_iterator_pair( pair&lt;Iterator1, Iterator2&gt; );</div><div>}<br></div>=
<div>[/code]</div><div>&nbsp;</div><div><br>=D0=D1=D4=CE=C9=C3=C1, 27 =D3=
=C5=CE=D4=D1=C2=D2=D1 2013&nbsp;=C7., 17:49:27 UTC+4 =D0=CF=CC=D8=DA=CF=D7=
=C1=D4=C5=CC=D8 Vlad from Moscow =CE=C1=D0=C9=D3=C1=CC:</div><blockquote cl=
ass=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"><div>Did anybody make&nbsp;a proposal about=
 something as pair_iterator.</div><div>&nbsp;</div><div>As an idea: the pai=
r_iterator incorporates two iterators and its value_type is std::pair&lt;ty=
pename Iterator1::value_type, typename Iterator2::value_type&gt;&nbsp; </di=
v><div>&nbsp;</div><div>For example</div><div>&nbsp;</div><div>[code]</div>=
<div>&nbsp;</div><div>const size_t N =3D 10;</div><div>int a[N], b[N], c[N]=
, d[N];</div><div>&nbsp;</div><div>std::generate( std::begin( a ), std::end=
( a ), [] { return std::rand() % N; } );</div><div><div>std::generate( std:=
:begin(&nbsp;b ), std::end(&nbsp;b ), [] { return std::rand() % N; } );</di=
v><div>&nbsp;</div><div>std::transform( std::begin( a ), std::end( a ), std=
::begin( b ), </div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; std::make_pair_iterator( c, d ),</div><div>&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::minmax );</div><div>[/co=
de]</div><div>&nbsp;</div><div>Array c is filled with minimum values of ele=
ments of arrays a and b while array d is filled with maximumj values of ele=
ments of arrays a and b.</div><div></div></div></div></blockquote><div>&nbs=
p;</div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8e=
x; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-wi=
dth: 1px; border-left-style: solid;"><div dir=3D"ltr"><div><div>Any feedbac=
k is appreciated.&nbsp;</div></div></div></blockquote></div></blockquote></=
div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_1172_2014227.1380401951679--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Sat, 28 Sep 2013 21:54:03 -0700 (PDT)
Raw View
------=_Part_1278_6319418.1380430443838
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

I tested my wonderfull iterator iterator_pair and it works fine. For exampl=
e
=20
[code]
std::map<int, std::string> m;
std::string s =3D "Hello new iterator \"std::iterator_pair\"!";
std::istringstream is( s );
int i =3D 0;
std::transform( std::istream_iterator<std::string>( is ),
  std::istream_iterator<std::string>(),
  std::inserter( m, m.begin() ),=20
  [&i]( const std::string &s ) { return ( std::make_pair( i++, s ) ); } );=
=20
=20
std::vector<int> v1( m.size() );
std::vector<std::string> v2( m.size() );
std::copy( m.begin(), m.end(),=20
 usr::make_iterator_pair( v1.begin(), v2.begin() ) );
=20
for ( int x : v1 ) std::cout << x << ' ';
std::cout << std::endl;
=20
for ( const std::string &s : v2 ) std::cout << s << ' ';
std::cout << std::endl;
[/code]
=20
=20
However it seems that I found a very serious defect of the C++ Standard.
=20
If to change the code above the following way
=20
[code]
std::map<int, std::string> m;
std::string s =3D "Hello new iterator \"std::iterator_pair\"!";
std::istringstream is( s );
int i =3D 0;

std::transform( std::istream_iterator<std::string>( is ),
  std::istream_iterator<std::string>(),
  std::inserter( m, m.begin() ),=20
  [&i]( const std::string &s ) { return ( std::make_pair( i++, s ) ); } );=
=20
=20
std::vector<int> v1;
std::vector<std::string> v2;
v1.reserve( m.size() );
v2.reserve( m.size() );
=20
std::copy( m.begin(), m.end(),=20
 usr::make_iterator_pair( std::back_inserter( v1 ), std::back_inserter( v2=
=20
) ) );
=20
for ( int x : v1 ) std::cout << x << ' ';
std::cout << std::endl;
=20
for ( const std::string &s : v2 ) std::cout << s << ' ';
std::cout << std::endl;
[/code]
=20
It will not be compiled. The problem is that std::back_inserter is an=20
output iterator and its value_type is defined as void. As the result I get=
=20
std::pair<void, void>.
=20
Let's consider the following two iterators
=20
std::ostream_iterator<std::string> it1( std::cout, "\n" );
std::ostream_iterator<int> it2( std::cout, "\n" );
They are different though the both have the same template definitions. What=
=20
is the difference?
=20
You may write
=20
it1 =3D "abc";
it2 =3D 123;
but you may not write
=20
it1 =3D 123;
it2 =3D "abc";
=20
What does this mean?
=20
It means that these two iterators have different value types!=20
And as we see value type is an integral and important part of these=20
iterators. So these iterators have defined value types.
However in the C++ Standard they are defined such a way that their=20
value_type is defined as void.
It is a serious defect of the standard. The value_type for output iterators=
=20
shall not be defined as void because each output iterator including above=
=20
mentioned and also std::back_insert_iterator, std::front_insert_iterator,=
=20
and std::insert_iterator have concrete value types as I showed in the=20
example above with std::ostream_iterator.
=20
So each output iterator either shall have its defined value_type or=20
retranslate the value_type of an underlined iterator.
=20
Let's consider another simple example.
=20
template <OutputIterator>
void SomeFunction( OutputIterator iterator )
{
// some code
}
=20
And let's assume that we are going to define a variable inside the function=
=20
body that will have the type that may be processed by iterator. As the=20
iterator has value_type void there is no possibility to determine the type=
=20
of the variable.
=20
template <OutputIterator>
void SomeFunction( OutputIterator iterator )
{
WhatType? our_variable;
}
=20
I am sure that all output iterators must have a concrete value_type that=20
will differ from void.


=D7=CF=D3=CB=D2=C5=D3=C5=CE=D8=C5, 29 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 0=
:59:11 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from=20
Moscow =CE=C1=D0=C9=D3=C1=CC:

> A revised version of the iterator definition
> =20
> [code]
> namespace usr
> {
> template <class Iterator1, class Iterator2>
> class iterator_pair : public iterator<output_iterator_tag, void, void,=20
> void, void>=20
> {
> public:
>  typedef pair<Iterator1, Iterator2> iterator_type;
>  iterator_pair( Iterator1, Iterator2 );
>  explicit iterator_pair( const pair<Iterator1, Iterator2> & );
>  explicit iterator_pair( pair<Iterator1, Iterator2> && );
>  iterator_type base() const;
> =20
>  iterator_pair<Iterator1, Iterator2> &
>  operator =3D( const pair<typename iterator_traits<Iterator1>::value_type=
,
>                         typename iterator_traits<Iterator2>::value_type> =
&=20
> );
>  iterator_pair<Iterator1, Iterator2> &
>  operator =3D( pair<typename iterator_traits<Iterator1>::value_type,
>                      typename iterator_traits<Iterator2>::value_type> && =
);
>  iterator_pair<Iterator1, Iterator2> & operator *();
>  iterator_pair<Iterator1, Iterator2> & operator ++();
>  iterator_pair<Iterator1, Iterator2>   operator ++( int );
> protected:
>  iterator_type it;
> };
> template <class Iterator1, class Iterator2>
> iterator_pair<Iterator1, Iterator2> make_iterator_pair( Iterator1,=20
> Iterator2 );
> template <class Iterator1, class Iterator2>
> iterator_pair<Iterator1, Iterator2> make_iterator_pair( const=20
> pair<Iterator1, Iterator2> & );
> template <class Iterator1, class Iterator2>
> iterator_pair<Iterator1, Iterator2> make_iterator_pair( pair<Iterator1,=
=20
> Iterator2> && );
> }
> [/code]
> =20
>
> =D3=D5=C2=C2=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 22:54:24 UT=
C+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow=20
> =CE=C1=D0=C9=D3=C1=CC:
>
>> Here is an outline of the iterator definition
>> =20
>> [code]
>> namespace std
>> {
>> template <class Iterator1, class Iterator2>
>> class iterator_pair : public iterator<output_iterator_tag, void, void,=
=20
>> void, void>=20
>> {
>> public:
>>  typedef pair<Iterator1, Iterator2> iterator_type;
>>  iterator_pair( Iterator1, Iterator2 );
>>  iterator_pair( pair<Iterator1, Iterator2> );
>>  iterator_type base() const;
>> =20
>>  iterator_pair<Iterator1, Iterator2> &
>>  operator =3D( const pair<typename iterator_traits<Iterator1>::value_typ=
e,
>>                         typename iterator_traits<Iterator2>::value_type>=
=20
>> & );
>>  iterator_pair<Iterator1, Iterator2> &
>>  operator =3D( pair<typename iterator_traits<Iterator1>::value_type,
>>                      typename iterator_traits<Iterator2>::value_type> &&=
=20
>> );
>>  iterator_pair<Iterator1, Iterator2> & operator *();
>>  iterator_pair<Iterator1, Iterator2> & operator ++();
>>  iterator_pair<Iterator1, Iterator2>   operator ++( int );
>> protected:
>>  iterator_type it;
>> };
>> template <class Iterator1, class Iterator2>
>> iterator_pair<Iterator1, Iterator2> make_iterator_pair( Iterator1,=20
>> Iterator2 );
>> template <class Iterator1, class Iterator2>
>> iterator_pair<Iterator1, Iterator2> make_iterator_pair( pair<Iterator1,=
=20
>> Iterator2> );
>> }
>> [/code]
>> =20
>>
>> =D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 17:49:27 U=
TC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from=20
>> Moscow =CE=C1=D0=C9=D3=C1=CC:
>>
>>> Did anybody make a proposal about something as pair_iterator.
>>> =20
>>> As an idea: the pair_iterator incorporates two iterators and its=20
>>> value_type is std::pair<typename Iterator1::value_type, typename=20
>>> Iterator2::value_type> =20
>>> =20
>>> For example
>>> =20
>>> [code]
>>> =20
>>> const size_t N =3D 10;
>>> int a[N], b[N], c[N], d[N];
>>> =20
>>> std::generate( std::begin( a ), std::end( a ), [] { return std::rand() =
%=20
>>> N; } );
>>> std::generate( std::begin( b ), std::end( b ), [] { return std::rand() =
%=20
>>> N; } );
>>> =20
>>> std::transform( std::begin( a ), std::end( a ), std::begin( b ),=20
>>>                         std::make_pair_iterator( c, d ),
>>>                         std::minmax );
>>> [/code]
>>> =20
>>> Array c is filled with minimum values of elements of arrays a and b=20
>>> while array d is filled with maximumj values of elements of arrays a an=
d b.
>>>
>> =20
>>
>>> Any feedback is appreciated.=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_1278_6319418.1380430443838
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I tested my wonderfull iterator iterator_pair and it =
works fine. For example</div><div>&nbsp;</div><div>[code]</div><div>std::ma=
p&lt;int, std::string&gt; m;</div><div>std::string s =3D "Hello new iterato=
r \"std::iterator_pair\"!";<br>std::istringstream is( s );</div><div>int i =
=3D 0;<br></div><div>std::transform( std::istream_iterator&lt;std::string&g=
t;( is ),<br>&nbsp;&nbsp;std::istream_iterator&lt;std::string&gt;(),<br>&nb=
sp;&nbsp;std::inserter( m, m.begin() ), <br>&nbsp;&nbsp;[&amp;i]( const std=
::string &amp;s ) { return ( std::make_pair( i++, s ) ); } ); </div><div>&n=
bsp;</div><div>std::vector&lt;int&gt; v1( m.size() );<br>std::vector&lt;std=
::string&gt; v2( m.size() );<br></div><div>std::copy( m.begin(), m.end(), <=
br>&nbsp;usr::make_iterator_pair( v1.begin(), v2.begin() ) );</div><div>&nb=
sp;</div><div>for ( int x : v1 ) std::cout &lt;&lt; x &lt;&lt; ' ';<br>std:=
:cout &lt;&lt; std::endl;</div><div>&nbsp;</div><div>for ( const std::strin=
g &amp;s : v2 ) std::cout &lt;&lt; s &lt;&lt; ' ';<br>std::cout &lt;&lt; st=
d::endl;<br></div><div>[/code]</div><div>&nbsp;</div><div>&nbsp;</div><div>=
However it seems that I found a very serious defect of the C++ Standard.</d=
iv><div>&nbsp;</div><div>If to change the code above the following way</div=
><div>&nbsp;</div><div>[code]</div><div>std::map&lt;int, std::string&gt; m;=
</div><div>std::string s =3D "Hello new iterator \"std::iterator_pair\"!";<=
br>std::istringstream is( s );</div><div>int i =3D 0;</div><div><br>std::tr=
ansform( std::istream_iterator&lt;std::string&gt;( is ),<br>&nbsp;&nbsp;std=
::istream_iterator&lt;std::string&gt;(),<br>&nbsp;&nbsp;std::inserter( m, m=
..begin() ), <br>&nbsp;&nbsp;[&amp;i]( const std::string &amp;s ) { return (=
 std::make_pair( i++, s ) ); } ); </div><div>&nbsp;</div><div>std::vector&l=
t;int&gt; v1;<br>std::vector&lt;std::string&gt; v2;</div><div>v1.reserve( m=
..size() );<br>v2.reserve( m.size() );</div><div>&nbsp;</div><div>std::copy(=
 m.begin(), m.end(), <br>&nbsp;usr::make_iterator_pair( std::back_inserter(=
 v1 ), std::back_inserter( v2 ) ) );</div><div>&nbsp;</div><div>for ( int x=
 : v1 ) std::cout &lt;&lt; x &lt;&lt; ' ';<br>std::cout &lt;&lt; std::endl;=
</div><div>&nbsp;</div><div>for ( const std::string &amp;s : v2 ) std::cout=
 &lt;&lt; s &lt;&lt; ' ';<br>std::cout &lt;&lt; std::endl;<br>[/code]</div>=
<div>&nbsp;</div><div>It will not be compiled. The problem is that std::bac=
k_inserter is an output iterator and its value_type is defined as void. As =
the result I get std::pair&lt;void, void&gt;.</div><div>&nbsp;</div><div>Le=
t's consider the following two iterators</div><div>&nbsp;</div><div>std::os=
tream_iterator&lt;std::string&gt; it1( std::cout, "\n" );<br>std::ostream_i=
terator&lt;int&gt; it2( std::cout, "\n" );<br></div><div>They are different=
 though the both have the same template definitions. What is the difference=
?</div><div>&nbsp;</div><div>You&nbsp;may write</div><div>&nbsp;</div><div>=
it1 =3D "abc";<br>it2 =3D 123;<br></div><div>but you may not write</div><di=
v>&nbsp;</div><div><div>it1 =3D 123;<br>it2 =3D "abc";</div><div>&nbsp;</di=
v><div>What does this mean?</div><div>&nbsp;</div><div>It means that these =
two iterators have different value types! </div><div>And as we see value ty=
pe is an integral and important part of these iterators. So these iterators=
 have defined value types.</div><div>However in the C++ Standard they are d=
efined such a way that their value_type is defined as void.</div><div>It is=
 a serious defect of the standard. The value_type for output iterators shal=
l not be defined as void because each output iterator including above menti=
oned and also std::back_insert_iterator, std::front_insert_iterator, and st=
d::insert_iterator have concrete value types as I showed in the example abo=
ve with std::ostream_iterator.</div><div>&nbsp;</div><div>So each output it=
erator either shall have its defined value_type or retranslate the value_ty=
pe of an underlined iterator.</div><div>&nbsp;</div><div>Let's consider ano=
ther simple example.</div><div>&nbsp;</div><div>template &lt;OutputIterator=
&gt;</div><div>void SomeFunction( OutputIterator iterator )</div><div>{</di=
v><div>// some code</div><div>}</div><div>&nbsp;</div><div>And let's assume=
 that we are going to define a variable inside the function body that will =
have the type that may be processed by iterator. As the iterator has value_=
type void there is no possibility to determine the type of the variable.</d=
iv><div>&nbsp;</div><div><div>template &lt;OutputIterator&gt;</div><div>voi=
d SomeFunction( OutputIterator iterator )</div><div>{</div><div>WhatType? o=
ur_variable;</div><div>}</div><div>&nbsp;</div><div>I am sure that all outp=
ut iterators must have a concrete value_type that will differ from void.</d=
iv><br></div></div><div><br>=D7=CF=D3=CB=D2=C5=D3=C5=CE=D8=C5, 29 =D3=C5=CE=
=D4=D1=C2=D2=D1 2013&nbsp;=C7., 0:59:11 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=
=C5=CC=D8 Vlad from Moscow =CE=C1=D0=C9=D3=C1=CC:</div><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"><div>A revised version of the iterator definition=
</div><div>&nbsp;</div><div>[code]</div><div>namespace usr<br>{</div><div>t=
emplate &lt;class Iterator1, class Iterator2&gt;<br>class iterator_pair : p=
ublic iterator&lt;output_iterator_tag, void, void, void, void&gt; <br>{<br>=
public:<br>&nbsp;typedef pair&lt;Iterator1, Iterator2&gt;&nbsp;iterator_typ=
e;</div><div>&nbsp;iterator_pair( Iterator1, Iterator2 );<br>&nbsp;explicit=
 iterator_pair( const pair&lt;Iterator1, Iterator2&gt; &amp; );<br>&nbsp;ex=
plicit iterator_pair( pair&lt;Iterator1, Iterator2&gt; &amp;&amp; );</div><=
div>&nbsp;iterator_type base() const;<br>&nbsp;<br>&nbsp;iterator_pair&lt;I=
terator1, Iterator2&gt; &amp;<br>&nbsp;operator =3D( const pair&lt;typename=
 iterator_traits&lt;Iterator1&gt;::<wbr>value_type,<br>&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typename iterator_traits&lt;Ite=
rator2&gt;::<wbr>value_type&gt; &amp; );</div><div>&nbsp;iterator_pair&lt;I=
terator1, Iterator2&gt; &amp;<br>&nbsp;operator =3D( pair&lt;typename itera=
tor_traits&lt;Iterator1&gt;::<wbr>value_type,<br>&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; typename iterator_traits&lt;Iterator2&gt;::<wbr>value_t=
ype&gt; &amp;&amp; );</div><div>&nbsp;iterator_pair&lt;Iterator1, Iterator2=
&gt; &amp; operator *();<br>&nbsp;iterator_pair&lt;Iterator1, Iterator2&gt;=
 &amp; operator ++();<br>&nbsp;iterator_pair&lt;Iterator1, Iterator2&gt;&nb=
sp;&nbsp; operator ++( int );</div><div>protected:<br>&nbsp;iterator_type i=
t;<br>};</div><div>template &lt;class Iterator1, class Iterator2&gt;<br>ite=
rator_pair&lt;Iterator1, Iterator2&gt; make_iterator_pair( Iterator1, Itera=
tor2 );</div><div>template &lt;class Iterator1, class Iterator2&gt;<br>iter=
ator_pair&lt;Iterator1, Iterator2&gt; make_iterator_pair( const pair&lt;Ite=
rator1, Iterator2&gt; &amp; );</div><div>template &lt;class Iterator1, clas=
s Iterator2&gt;<br>iterator_pair&lt;Iterator1, Iterator2&gt; make_iterator_=
pair( pair&lt;Iterator1, Iterator2&gt; &amp;&amp; );</div><div>}<br></div><=
div>[/code]</div><div>&nbsp;</div><div><br>=D3=D5=C2=C2=CF=D4=C1, 28 =D3=C5=
=CE=D4=D1=C2=D2=D1 2013&nbsp;=C7., 22:54:24 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=
=D4=C5=CC=D8 Vlad from Moscow =CE=C1=D0=C9=D3=C1=CC:</div><blockquote class=
=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; bor=
der-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-sty=
le: solid;"><div dir=3D"ltr"><div>Here is&nbsp;an outline of the iterator d=
efinition</div><div>&nbsp;</div><div>[code]</div><div>namespace std<br>{</d=
iv><div>template &lt;class Iterator1, class Iterator2&gt;</div><div>class i=
terator_pair : public iterator&lt;output_iterator_tag, void, void, void, vo=
id&gt; <br>{<br>public:<br>&nbsp;typedef pair&lt;Iterator1, Iterator2&gt;&n=
bsp;iterator_type;</div><div>&nbsp;iterator_pair( Iterator1, Iterator2 );<b=
r>&nbsp;iterator_pair( pair&lt;Iterator1, Iterator2&gt; );</div><div>&nbsp;=
iterator_type base() const;<br>&nbsp;<br>&nbsp;iterator_pair&lt;Iterator1, =
Iterator2&gt; &amp;<br>&nbsp;operator =3D( const pair&lt;typename iterator_=
traits&lt;Iterator1&gt;::<wbr>value_type,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typename iterator_traits&lt;Iterator2&gt;=
::<wbr>value_type&gt; &amp; );</div><div>&nbsp;iterator_pair&lt;Iterator1, =
Iterator2&gt; &amp;<br>&nbsp;operator =3D( pair&lt;typename iterator_traits=
&lt;Iterator1&gt;::<wbr>value_type,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp; typename iterator_traits&lt;Iterator2&gt;::<wbr>value_type&gt; &a=
mp;&amp; );</div><div>&nbsp;iterator_pair&lt;Iterator1, Iterator2&gt; &amp;=
 operator *();<br>&nbsp;iterator_pair&lt;Iterator1, Iterator2&gt; &amp; ope=
rator ++();<br>&nbsp;iterator_pair&lt;Iterator1, Iterator2&gt;&nbsp;&nbsp; =
operator ++( int );</div><div>protected:<br>&nbsp;iterator_type it;<br>};</=
div><div>template &lt;class Iterator1, class Iterator2&gt;<br>iterator_pair=
&lt;Iterator1, Iterator2&gt; make_iterator_pair( Iterator1, Iterator2 );</d=
iv><div>template &lt;class Iterator1, class Iterator2&gt;<br>iterator_pair&=
lt;Iterator1, Iterator2&gt; make_iterator_pair( pair&lt;Iterator1, Iterator=
2&gt; );</div><div>}<br></div><div>[/code]</div><div>&nbsp;</div><div><br>=
=D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013&nbsp;=C7., 17:49:27=
 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow =CE=C1=D0=C9=
=D3=C1=CC:</div><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"><div>Did anyb=
ody make&nbsp;a proposal about something as pair_iterator.</div><div>&nbsp;=
</div><div>As an idea: the pair_iterator incorporates two iterators and its=
 value_type is std::pair&lt;typename Iterator1::value_type, typename Iterat=
or2::value_type&gt;&nbsp; </div><div>&nbsp;</div><div>For example</div><div=
>&nbsp;</div><div>[code]</div><div>&nbsp;</div><div>const size_t N =3D 10;<=
/div><div>int a[N], b[N], c[N], d[N];</div><div>&nbsp;</div><div>std::gener=
ate( std::begin( a ), std::end( a ), [] { return std::rand() % N; } );</div=
><div><div>std::generate( std::begin(&nbsp;b ), std::end(&nbsp;b ), [] { re=
turn std::rand() % N; } );</div><div>&nbsp;</div><div>std::transform( std::=
begin( a ), std::end( a ), std::begin( b ), </div><div>&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::make_pair_iterator( c, d )=
,</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 std::minmax );</div><div>[/code]</div><div>&nbsp;</div><div>Array c is fil=
led with minimum values of elements of arrays a and b while array d is fill=
ed with maximumj values of elements of arrays a and b.</div><div></div></di=
v></div></blockquote><div>&nbsp;</div><blockquote class=3D"gmail_quote" sty=
le=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"><div><div>Any feedback is appreciated.&nbsp;</div></div></div></bl=
ockquote></div></blockquote></div></blockquote></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_1278_6319418.1380430443838--

.


Author: "Billy O'Neal" <billy.oneal@gmail.com>
Date: Sat, 28 Sep 2013 22:04:06 -0700
Raw View
--047d7bd756e28f550904e77ea8cb
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

[quote]
It means that these two iterators have different value types!
And as we see value type is an integral and important part of these
iterators. So these iterators have defined value types.
However in the C++ Standard they are defined such a way that their
value_type is defined as void.
[/quote]

Of course, there's nothing stopping an output iterator from having multiple
effective value types. (I believe confusion over iterator categories is the
reason zip iterator is held up if I am not mistaken... though that's
completely anecdotal on my part)

Billy O'Neal
https://github.com/BillyONeal/ <https://bitbucket.org/BillyONeal/>
http://stackoverflow.com/users/82320/billy-oneal
Malware Response Instructor - BleepingComputer.com


On Sat, Sep 28, 2013 at 9:54 PM, Vlad from Moscow <vlad.moscow@mail.ru>wrot=
e:

> I tested my wonderfull iterator iterator_pair and it works fine. For
> example
>
> [code]
> std::map<int, std::string> m;
> std::string s =3D "Hello new iterator \"std::iterator_pair\"!";
> std::istringstream is( s );
> int i =3D 0;
> std::transform( std::istream_iterator<std::string>( is ),
>   std::istream_iterator<std::string>(),
>   std::inserter( m, m.begin() ),
>   [&i]( const std::string &s ) { return ( std::make_pair( i++, s ) ); } )=
;
>
> std::vector<int> v1( m.size() );
> std::vector<std::string> v2( m.size() );
> std::copy( m.begin(), m.end(),
>  usr::make_iterator_pair( v1.begin(), v2.begin() ) );
>
> for ( int x : v1 ) std::cout << x << ' ';
> std::cout << std::endl;
>
> for ( const std::string &s : v2 ) std::cout << s << ' ';
> std::cout << std::endl;
> [/code]
>
>
> However it seems that I found a very serious defect of the C++ Standard.
>
> If to change the code above the following way
>
> [code]
> std::map<int, std::string> m;
> std::string s =3D "Hello new iterator \"std::iterator_pair\"!";
> std::istringstream is( s );
> int i =3D 0;
>
> std::transform( std::istream_iterator<std::string>( is ),
>   std::istream_iterator<std::string>(),
>   std::inserter( m, m.begin() ),
>   [&i]( const std::string &s ) { return ( std::make_pair( i++, s ) ); } )=
;
>
> std::vector<int> v1;
> std::vector<std::string> v2;
> v1.reserve( m.size() );
> v2.reserve( m.size() );
>
> std::copy( m.begin(), m.end(),
>  usr::make_iterator_pair( std::back_inserter( v1 ), std::back_inserter( v=
2
> ) ) );
>
> for ( int x : v1 ) std::cout << x << ' ';
> std::cout << std::endl;
>
> for ( const std::string &s : v2 ) std::cout << s << ' ';
> std::cout << std::endl;
> [/code]
>
> It will not be compiled. The problem is that std::back_inserter is an
> output iterator and its value_type is defined as void. As the result I ge=
t
> std::pair<void, void>.
>
> Let's consider the following two iterators
>
> std::ostream_iterator<std::string> it1( std::cout, "\n" );
> std::ostream_iterator<int> it2( std::cout, "\n" );
> They are different though the both have the same template definitions.
> What is the difference?
>
> You may write
>
> it1 =3D "abc";
> it2 =3D 123;
> but you may not write
>
> it1 =3D 123;
> it2 =3D "abc";
>
> What does this mean?
>
> It means that these two iterators have different value types!
> And as we see value type is an integral and important part of these
> iterators. So these iterators have defined value types.
> However in the C++ Standard they are defined such a way that their
> value_type is defined as void.
> It is a serious defect of the standard. The value_type for output
> iterators shall not be defined as void because each output iterator
> including above mentioned and also std::back_insert_iterator,
> std::front_insert_iterator, and std::insert_iterator have concrete value
> types as I showed in the example above with std::ostream_iterator.
>
> So each output iterator either shall have its defined value_type or
> retranslate the value_type of an underlined iterator.
>
> Let's consider another simple example.
>
> template <OutputIterator>
> void SomeFunction( OutputIterator iterator )
> {
> // some code
> }
>
> And let's assume that we are going to define a variable inside the
> function body that will have the type that may be processed by iterator. =
As
> the iterator has value_type void there is no possibility to determine the
> type of the variable.
>
> template <OutputIterator>
> void SomeFunction( OutputIterator iterator )
> {
> WhatType? our_variable;
> }
>
> I am sure that all output iterators must have a concrete value_type that
> will differ from void.
>
>
> =D7=CF=D3=CB=D2=C5=D3=C5=CE=D8=C5, 29 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7.,=
 0:59:11 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from
> Moscow =CE=C1=D0=C9=D3=C1=CC:
>
>> A revised version of the iterator definition
>>
>> [code]
>> namespace usr
>> {
>> template <class Iterator1, class Iterator2>
>> class iterator_pair : public iterator<output_iterator_tag, void, void,
>> void, void>
>> {
>> public:
>>  typedef pair<Iterator1, Iterator2> iterator_type;
>>  iterator_pair( Iterator1, Iterator2 );
>>  explicit iterator_pair( const pair<Iterator1, Iterator2> & );
>>  explicit iterator_pair( pair<Iterator1, Iterator2> && );
>>  iterator_type base() const;
>>
>>  iterator_pair<Iterator1, Iterator2> &
>>  operator =3D( const pair<typename iterator_traits<Iterator1>::**
>> value_type,
>>                         typename iterator_traits<Iterator2>::**value_typ=
e>
>> & );
>>  iterator_pair<Iterator1, Iterator2> &
>>  operator =3D( pair<typename iterator_traits<Iterator1>::**value_type,
>>                      typename iterator_traits<Iterator2>::**value_type>
>> && );
>>  iterator_pair<Iterator1, Iterator2> & operator *();
>>  iterator_pair<Iterator1, Iterator2> & operator ++();
>>  iterator_pair<Iterator1, Iterator2>   operator ++( int );
>> protected:
>>  iterator_type it;
>> };
>> template <class Iterator1, class Iterator2>
>> iterator_pair<Iterator1, Iterator2> make_iterator_pair( Iterator1,
>> Iterator2 );
>> template <class Iterator1, class Iterator2>
>> iterator_pair<Iterator1, Iterator2> make_iterator_pair( const
>> pair<Iterator1, Iterator2> & );
>> template <class Iterator1, class Iterator2>
>> iterator_pair<Iterator1, Iterator2> make_iterator_pair( pair<Iterator1,
>> Iterator2> && );
>> }
>> [/code]
>>
>>
>> =D3=D5=C2=C2=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 22:54:24 U=
TC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from
>> Moscow =CE=C1=D0=C9=D3=C1=CC:
>>
>>> Here is an outline of the iterator definition
>>>
>>> [code]
>>> namespace std
>>> {
>>> template <class Iterator1, class Iterator2>
>>> class iterator_pair : public iterator<output_iterator_tag, void, void,
>>> void, void>
>>> {
>>> public:
>>>  typedef pair<Iterator1, Iterator2> iterator_type;
>>>  iterator_pair( Iterator1, Iterator2 );
>>>  iterator_pair( pair<Iterator1, Iterator2> );
>>>  iterator_type base() const;
>>>
>>>  iterator_pair<Iterator1, Iterator2> &
>>>  operator =3D( const pair<typename iterator_traits<Iterator1>::**
>>> value_type,
>>>                         typename iterator_traits<Iterator2>::**value_ty=
pe>
>>> & );
>>>  iterator_pair<Iterator1, Iterator2> &
>>>  operator =3D( pair<typename iterator_traits<Iterator1>::**value_type,
>>>                      typename iterator_traits<Iterator2>::**value_type>
>>> && );
>>>  iterator_pair<Iterator1, Iterator2> & operator *();
>>>  iterator_pair<Iterator1, Iterator2> & operator ++();
>>>  iterator_pair<Iterator1, Iterator2>   operator ++( int );
>>> protected:
>>>  iterator_type it;
>>> };
>>> template <class Iterator1, class Iterator2>
>>> iterator_pair<Iterator1, Iterator2> make_iterator_pair( Iterator1,
>>> Iterator2 );
>>> template <class Iterator1, class Iterator2>
>>> iterator_pair<Iterator1, Iterator2> make_iterator_pair( pair<Iterator1,
>>> Iterator2> );
>>> }
>>> [/code]
>>>
>>>
>>> =D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 17:49:27 =
UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from
>>> Moscow =CE=C1=D0=C9=D3=C1=CC:
>>>
>>>> Did anybody make a proposal about something as pair_iterator.
>>>>
>>>> As an idea: the pair_iterator incorporates two iterators and its
>>>> value_type is std::pair<typename Iterator1::value_type, typename
>>>> Iterator2::value_type>
>>>>
>>>> For example
>>>>
>>>> [code]
>>>>
>>>> const size_t N =3D 10;
>>>> int a[N], b[N], c[N], d[N];
>>>>
>>>> std::generate( std::begin( a ), std::end( a ), [] { return std::rand()
>>>> % N; } );
>>>> std::generate( std::begin( b ), std::end( b ), [] { return std::rand()
>>>> % N; } );
>>>>
>>>> std::transform( std::begin( a ), std::end( a ), std::begin( b ),
>>>>                         std::make_pair_iterator( c, d ),
>>>>                         std::minmax );
>>>> [/code]
>>>>
>>>> Array c is filled with minimum values of elements of arrays a and b
>>>> while array d is filled with maximumj values of elements of arrays a a=
nd b.
>>>>
>>>
>>>
>>>> Any feedback is appreciated.
>>>>
>>>  --
>
> ---
> 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/.
>

--=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/.

--047d7bd756e28f550904e77ea8cb
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">[quote]<div><div style=3D"font-family:arial,sans-serif;fon=
t-size:13px">It means that these two iterators have different value types!<=
/div><div style=3D"font-family:arial,sans-serif;font-size:13px">And as we s=
ee value type is an integral and important part of these iterators. So thes=
e iterators have defined value types.</div>

<div style=3D"font-family:arial,sans-serif;font-size:13px">However in the C=
++ Standard they are defined such a way that their value_type is defined as=
 void.</div></div><div style=3D"font-family:arial,sans-serif;font-size:13px=
">

[/quote]</div><div style=3D"font-family:arial,sans-serif;font-size:13px"><b=
r></div><div style=3D"font-family:arial,sans-serif;font-size:13px">Of cours=
e, there&#39;s nothing stopping an output iterator from having multiple eff=
ective value types. (I believe confusion over iterator categories is the re=
ason zip iterator is held up if I am not mistaken... though that&#39;s comp=
letely anecdotal on my part)</div>

</div><div class=3D"gmail_extra"><br clear=3D"all"><div><div dir=3D"ltr"><d=
iv>Billy O&#39;Neal</div><div><a href=3D"https://bitbucket.org/BillyONeal/"=
 target=3D"_blank">https://github.com/BillyONeal/</a></div><div><a href=3D"=
http://stackoverflow.com/users/82320/billy-oneal" target=3D"_blank">http://=
stackoverflow.com/users/82320/billy-oneal</a></div>

<div>Malware Response Instructor - BleepingComputer.com</div></div></div>
<br><br><div class=3D"gmail_quote">On Sat, Sep 28, 2013 at 9:54 PM, Vlad fr=
om Moscow <span dir=3D"ltr">&lt;<a href=3D"mailto:vlad.moscow@mail.ru" targ=
et=3D"_blank">vlad.moscow@mail.ru</a>&gt;</span> wrote:<br><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pad=
ding-left:1ex">

<div dir=3D"ltr"><div>I tested my wonderfull iterator iterator_pair and it =
works fine. For example</div><div>=9A</div><div>[code]</div><div>std::map&l=
t;int, std::string&gt; m;</div><div>std::string s =3D &quot;Hello new itera=
tor \&quot;std::iterator_pair\&quot;!&quot;;<br>

std::istringstream is( s );</div><div>int i =3D 0;<br></div><div>std::trans=
form( std::istream_iterator&lt;std::string&gt;( is ),<br>=9A=9Astd::istream=
_iterator&lt;std::string&gt;(),<br>=9A=9Astd::inserter( m, m.begin() ), <br=
>=9A=9A[&amp;i]( const std::string &amp;s ) { return ( std::make_pair( i++,=
 s ) ); } ); </div>

<div>=9A</div><div>std::vector&lt;int&gt; v1( m.size() );<br>std::vector&lt=
;std::string&gt; v2( m.size() );<br></div><div>std::copy( m.begin(), m.end(=
), <br>=9Ausr::make_iterator_pair( v1.begin(), v2.begin() ) );</div><div>=
=9A</div>

<div>for ( int x : v1 ) std::cout &lt;&lt; x &lt;&lt; &#39; &#39;;<br>std::=
cout &lt;&lt; std::endl;</div><div>=9A</div><div>for ( const std::string &a=
mp;s : v2 ) std::cout &lt;&lt; s &lt;&lt; &#39; &#39;;<br>std::cout &lt;&lt=
; std::endl;<br>

</div><div>[/code]</div><div>=9A</div><div>=9A</div><div>However it seems t=
hat I found a very serious defect of the C++ Standard.</div><div>=9A</div><=
div>If to change the code above the following way</div><div>=9A</div><div>[=
code]</div>

<div>std::map&lt;int, std::string&gt; m;</div><div>std::string s =3D &quot;=
Hello new iterator \&quot;std::iterator_pair\&quot;!&quot;;<br>std::istring=
stream is( s );</div><div>int i =3D 0;</div><div><br>std::transform( std::i=
stream_iterator&lt;std::string&gt;( is ),<br>

=9A=9Astd::istream_iterator&lt;std::string&gt;(),<br>=9A=9Astd::inserter( m=
, m.begin() ), <br>=9A=9A[&amp;i]( const std::string &amp;s ) { return ( st=
d::make_pair( i++, s ) ); } ); </div><div>=9A</div><div>std::vector&lt;int&=
gt; v1;<br>

std::vector&lt;std::string&gt; v2;</div><div>v1.reserve( m.size() );<br>v2.=
reserve( m.size() );</div><div>=9A</div><div>std::copy( m.begin(), m.end(),=
 <br>=9Ausr::make_iterator_pair( std::back_inserter( v1 ), std::back_insert=
er( v2 ) ) );</div>

<div>=9A</div><div>for ( int x : v1 ) std::cout &lt;&lt; x &lt;&lt; &#39; &=
#39;;<br>std::cout &lt;&lt; std::endl;</div><div>=9A</div><div>for ( const =
std::string &amp;s : v2 ) std::cout &lt;&lt; s &lt;&lt; &#39; &#39;;<br>std=
::cout &lt;&lt; std::endl;<br>

[/code]</div><div>=9A</div><div>It will not be compiled. The problem is tha=
t std::back_inserter is an output iterator and its value_type is defined as=
 void. As the result I get std::pair&lt;void, void&gt;.</div><div>=9A</div>

<div>Let&#39;s consider the following two iterators</div><div>=9A</div><div=
>std::ostream_iterator&lt;std::string&gt; it1( std::cout, &quot;\n&quot; );=
<br>std::ostream_iterator&lt;int&gt; it2( std::cout, &quot;\n&quot; );<br>

</div><div>They are different though the both have the same template defini=
tions. What is the difference?</div><div>=9A</div><div>You=9Amay write</div=
><div>=9A</div><div>it1 =3D &quot;abc&quot;;<br>it2 =3D 123;<br></div><div>=
but you may not write</div>

<div>=9A</div><div><div>it1 =3D 123;<br>it2 =3D &quot;abc&quot;;</div><div>=
=9A</div><div>What does this mean?</div><div>=9A</div><div>It means that th=
ese two iterators have different value types! </div><div>And as we see valu=
e type is an integral and important part of these iterators. So these itera=
tors have defined value types.</div>

<div>However in the C++ Standard they are defined such a way that their val=
ue_type is defined as void.</div><div>It is a serious defect of the standar=
d. The value_type for output iterators shall not be defined as void because=
 each output iterator including above mentioned and also std::back_insert_i=
terator, std::front_insert_iterator, and std::insert_iterator have concrete=
 value types as I showed in the example above with std::ostream_iterator.</=
div>

<div>=9A</div><div>So each output iterator either shall have its defined va=
lue_type or retranslate the value_type of an underlined iterator.</div><div=
>=9A</div><div>Let&#39;s consider another simple example.</div><div>=9A</di=
v>

<div>template &lt;OutputIterator&gt;</div><div>void SomeFunction( OutputIte=
rator iterator )</div><div>{</div><div>// some code</div><div>}</div><div>=
=9A</div><div>And let&#39;s assume that we are going to define a variable i=
nside the function body that will have the type that may be processed by it=
erator. As the iterator has value_type void there is no possibility to dete=
rmine the type of the variable.</div>

<div>=9A</div><div><div>template &lt;OutputIterator&gt;</div><div>void Some=
Function( OutputIterator iterator )</div><div>{</div><div>WhatType? our_var=
iable;</div><div>}</div><div>=9A</div><div>I am sure that all output iterat=
ors must have a concrete value_type that will differ from void.</div>

<br></div></div><div><br>=D7=CF=D3=CB=D2=C5=D3=C5=CE=D8=C5, 29 =D3=C5=CE=D4=
=D1=C2=D2=D1 2013=9A=C7., 0:59:11 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=
=D8 Vlad from Moscow =CE=C1=D0=C9=D3=C1=CC:</div><blockquote class=3D"gmail=
_quote" style=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-colo=
r:rgb(204,204,204);border-left-width:1px;border-left-style:solid">

<div dir=3D"ltr"><div>A revised version of the iterator definition</div><di=
v>=9A</div><div>[code]</div><div>namespace usr<br>{</div><div>template &lt;=
class Iterator1, class Iterator2&gt;<br>class iterator_pair : public iterat=
or&lt;output_iterator_tag, void, void, void, void&gt; <br>

{<br>public:<br>=9Atypedef pair&lt;Iterator1, Iterator2&gt;=9Aiterator_type=
;</div><div>=9Aiterator_pair( Iterator1, Iterator2 );<br>=9Aexplicit iterat=
or_pair( const pair&lt;Iterator1, Iterator2&gt; &amp; );<br>=9Aexplicit ite=
rator_pair( pair&lt;Iterator1, Iterator2&gt; &amp;&amp; );</div>

<div>=9Aiterator_type base() const;<br>=9A<br>=9Aiterator_pair&lt;Iterator1=
, Iterator2&gt; &amp;<br>=9Aoperator =3D( const pair&lt;typename iterator_t=
raits&lt;Iterator1&gt;::<u></u>value_type,<br>=9A=9A=9A=9A=9A=9A=9A=9A=9A=
=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A typename iterator_traits&lt;Iter=
ator2&gt;::<u></u>value_type&gt; &amp; );</div>

<div>=9Aiterator_pair&lt;Iterator1, Iterator2&gt; &amp;<br>=9Aoperator =3D(=
 pair&lt;typename iterator_traits&lt;Iterator1&gt;::<u></u>value_type,<br>=
=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A typename itera=
tor_traits&lt;Iterator2&gt;::<u></u>value_type&gt; &amp;&amp; );</div>

<div>=9Aiterator_pair&lt;Iterator1, Iterator2&gt; &amp; operator *();<br>=
=9Aiterator_pair&lt;Iterator1, Iterator2&gt; &amp; operator ++();<br>=9Aite=
rator_pair&lt;Iterator1, Iterator2&gt;=9A=9A operator ++( int );</div><div>=
protected:<br>

=9Aiterator_type it;<br>};</div><div>template &lt;class Iterator1, class It=
erator2&gt;<br>iterator_pair&lt;Iterator1, Iterator2&gt; make_iterator_pair=
( Iterator1, Iterator2 );</div><div>template &lt;class Iterator1, class Ite=
rator2&gt;<br>

iterator_pair&lt;Iterator1, Iterator2&gt; make_iterator_pair( const pair&lt=
;Iterator1, Iterator2&gt; &amp; );</div><div>template &lt;class Iterator1, =
class Iterator2&gt;<br>iterator_pair&lt;Iterator1, Iterator2&gt; make_itera=
tor_pair( pair&lt;Iterator1, Iterator2&gt; &amp;&amp; );</div>

<div>}<br></div><div>[/code]</div><div>=9A</div><div><br>=D3=D5=C2=C2=CF=D4=
=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013=9A=C7., 22:54:24 UTC+4 =D0=CF=CC=D8=
=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow =CE=C1=D0=C9=D3=C1=CC:</div><bloc=
kquote 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-s=
tyle:solid">

<div dir=3D"ltr"><div>Here is=9Aan outline of the iterator definition</div>=
<div>=9A</div><div>[code]</div><div>namespace std<br>{</div><div>template &=
lt;class Iterator1, class Iterator2&gt;</div><div>class iterator_pair : pub=
lic iterator&lt;output_iterator_tag, void, void, void, void&gt; <br>

{<br>public:<br>=9Atypedef pair&lt;Iterator1, Iterator2&gt;=9Aiterator_type=
;</div><div>=9Aiterator_pair( Iterator1, Iterator2 );<br>=9Aiterator_pair( =
pair&lt;Iterator1, Iterator2&gt; );</div><div>=9Aiterator_type base() const=
;<br>
=9A<br>
=9Aiterator_pair&lt;Iterator1, Iterator2&gt; &amp;<br>=9Aoperator =3D( cons=
t pair&lt;typename iterator_traits&lt;Iterator1&gt;::<u></u>value_type,<br>=
=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A typen=
ame iterator_traits&lt;Iterator2&gt;::<u></u>value_type&gt; &amp; );</div>

<div>=9Aiterator_pair&lt;Iterator1, Iterator2&gt; &amp;<br>=9Aoperator =3D(=
 pair&lt;typename iterator_traits&lt;Iterator1&gt;::<u></u>value_type,<br>=
=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A typename itera=
tor_traits&lt;Iterator2&gt;::<u></u>value_type&gt; &amp;&amp; );</div>

<div>=9Aiterator_pair&lt;Iterator1, Iterator2&gt; &amp; operator *();<br>=
=9Aiterator_pair&lt;Iterator1, Iterator2&gt; &amp; operator ++();<br>=9Aite=
rator_pair&lt;Iterator1, Iterator2&gt;=9A=9A operator ++( int );</div><div>=
protected:<br>

=9Aiterator_type it;<br>};</div><div>template &lt;class Iterator1, class It=
erator2&gt;<br>iterator_pair&lt;Iterator1, Iterator2&gt; make_iterator_pair=
( Iterator1, Iterator2 );</div><div>template &lt;class Iterator1, class Ite=
rator2&gt;<br>

iterator_pair&lt;Iterator1, Iterator2&gt; make_iterator_pair( pair&lt;Itera=
tor1, Iterator2&gt; );</div><div>}<br></div><div>[/code]</div><div>=9A</div=
><div><br>=D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013=9A=C7., 1=
7:49:27 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow =CE=C1=
=D0=C9=D3=C1=CC:</div>

<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-l=
eft-style:solid"><div dir=3D"ltr"><div>Did anybody make=9Aa proposal about =
something as pair_iterator.</div>

<div>=9A</div><div>As an idea: the pair_iterator incorporates two iterators=
 and its value_type is std::pair&lt;typename Iterator1::value_type, typenam=
e Iterator2::value_type&gt;=9A </div><div>=9A</div><div>For example</div><d=
iv>

=9A</div><div>[code]</div><div>=9A</div><div>const size_t N =3D 10;</div><d=
iv>int a[N], b[N], c[N], d[N];</div><div>=9A</div><div>std::generate( std::=
begin( a ), std::end( a ), [] { return std::rand() % N; } );</div><div><div=
>std::generate( std::begin(=9Ab ), std::end(=9Ab ), [] { return std::rand()=
 % N; } );</div>

<div>=9A</div><div>std::transform( std::begin( a ), std::end( a ), std::beg=
in( b ), </div><div>=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=
=9A=9A=9A=9A=9A std::make_pair_iterator( c, d ),</div><div>=9A=9A=9A=9A=9A=
=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A std::minmax );</div>=
<div>[/code]</div>

<div>=9A</div><div>Array c is filled with minimum values of elements of arr=
ays a and b while array d is filled with maximumj values of elements of arr=
ays a and b.</div><div></div></div></div></blockquote><div>=9A</div><blockq=
uote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;padding-left:1=
ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-sty=
le:solid">

<div dir=3D"ltr"><div><div>Any feedback is appreciated.=9A</div></div></div=
></blockquote></div></blockquote></div></blockquote></div><span class=3D"HO=
EnZb"><font color=3D"#888888">

<p></p>

-- <br>
=9A<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%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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 />

--047d7bd756e28f550904e77ea8cb--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Sun, 29 Sep 2013 07:01:11 -0700 (PDT)
Raw View
------=_Part_2105_25718147.1380463271758
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

=20
I am sure that the fact that outer iterators do not provide to the outer=20
world the actual type of the value_type of objects that they can deal with=
=20
and instead of this they report incorrectly type void is a serious defect=
=20
of the C++ Standard.=20
The actual value of the value_type is integral, unique and important=20
characteristic of any output iterator. An output iterator is not a Black=20
Hole that can deal with any type of objects.
std::ostream_iterator has value_type that is the template parameter T.=20
std::back_insert_iterator has value_type that is typename=20
Container::value_type. And so on. This information shall be provided for=20
the outer world. To provide instead of the actual value type type void is a=
=20
gross error.=20
=20
I will prepare a defect report if there is no yet such a defect report.=20

=D7=CF=D3=CB=D2=C5=D3=C5=CE=D8=C5, 29 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 8=
:54:03 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from=20
Moscow =CE=C1=D0=C9=D3=C1=CC:

> I tested my wonderfull iterator iterator_pair and it works fine. For=20
> example
> =20
> [code]
> std::map<int, std::string> m;
> std::string s =3D "Hello new iterator \"std::iterator_pair\"!";
> std::istringstream is( s );
> int i =3D 0;
> std::transform( std::istream_iterator<std::string>( is ),
>   std::istream_iterator<std::string>(),
>   std::inserter( m, m.begin() ),=20
>   [&i]( const std::string &s ) { return ( std::make_pair( i++, s ) ); } )=
;=20
> =20
> std::vector<int> v1( m.size() );
> std::vector<std::string> v2( m.size() );
> std::copy( m.begin(), m.end(),=20
>  usr::make_iterator_pair( v1.begin(), v2.begin() ) );
> =20
> for ( int x : v1 ) std::cout << x << ' ';
> std::cout << std::endl;
> =20
> for ( const std::string &s : v2 ) std::cout << s << ' ';
> std::cout << std::endl;
> [/code]
> =20
> =20
> However it seems that I found a very serious defect of the C++ Standard.
> =20
> If to change the code above the following way
> =20
> [code]
> std::map<int, std::string> m;
> std::string s =3D "Hello new iterator \"std::iterator_pair\"!";
> std::istringstream is( s );
> int i =3D 0;
>
> std::transform( std::istream_iterator<std::string>( is ),
>   std::istream_iterator<std::string>(),
>   std::inserter( m, m.begin() ),=20
>   [&i]( const std::string &s ) { return ( std::make_pair( i++, s ) ); } )=
;=20
> =20
> std::vector<int> v1;
> std::vector<std::string> v2;
> v1.reserve( m.size() );
> v2.reserve( m.size() );
> =20
> std::copy( m.begin(), m.end(),=20
>  usr::make_iterator_pair( std::back_inserter( v1 ), std::back_inserter( v=
2=20
> ) ) );
> =20
> for ( int x : v1 ) std::cout << x << ' ';
> std::cout << std::endl;
> =20
> for ( const std::string &s : v2 ) std::cout << s << ' ';
> std::cout << std::endl;
> [/code]
> =20
> It will not be compiled. The problem is that std::back_inserter is an=20
> output iterator and its value_type is defined as void. As the result I ge=
t=20
> std::pair<void, void>.
> =20
> Let's consider the following two iterators
> =20
> std::ostream_iterator<std::string> it1( std::cout, "\n" );
> std::ostream_iterator<int> it2( std::cout, "\n" );
> They are different though the both have the same template definitions.=20
> What is the difference?
> =20
> You may write
> =20
> it1 =3D "abc";
> it2 =3D 123;
> but you may not write
> =20
> it1 =3D 123;
> it2 =3D "abc";
> =20
> What does this mean?
> =20
> It means that these two iterators have different value types!=20
> And as we see value type is an integral and important part of these=20
> iterators. So these iterators have defined value types.
> However in the C++ Standard they are defined such a way that their=20
> value_type is defined as void.
> It is a serious defect of the standard. The value_type for output=20
> iterators shall not be defined as void because each output iterator=20
> including above mentioned and also std::back_insert_iterator,=20
> std::front_insert_iterator, and std::insert_iterator have concrete value=
=20
> types as I showed in the example above with std::ostream_iterator.
> =20
> So each output iterator either shall have its defined value_type or=20
> retranslate the value_type of an underlined iterator.
> =20
> Let's consider another simple example.
> =20
> template <OutputIterator>
> void SomeFunction( OutputIterator iterator )
> {
> // some code
> }
> =20
> And let's assume that we are going to define a variable inside the=20
> function body that will have the type that may be processed by iterator. =
As=20
> the iterator has value_type void there is no possibility to determine the=
=20
> type of the variable.
> =20
> template <OutputIterator>
> void SomeFunction( OutputIterator iterator )
> {
> WhatType? our_variable;
> }
> =20
> I am sure that all output iterators must have a concrete value_type that=
=20
> will differ from void.
>
>
> =D7=CF=D3=CB=D2=C5=D3=C5=CE=D8=C5, 29 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7.,=
 0:59:11 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from=20
> Moscow =CE=C1=D0=C9=D3=C1=CC:
>
>> A revised version of the iterator definition
>> =20
>> [code]
>> namespace usr
>> {
>> template <class Iterator1, class Iterator2>
>> class iterator_pair : public iterator<output_iterator_tag, void, void,=
=20
>> void, void>=20
>> {
>> public:
>>  typedef pair<Iterator1, Iterator2> iterator_type;
>>  iterator_pair( Iterator1, Iterator2 );
>>  explicit iterator_pair( const pair<Iterator1, Iterator2> & );
>>  explicit iterator_pair( pair<Iterator1, Iterator2> && );
>>  iterator_type base() const;
>> =20
>>  iterator_pair<Iterator1, Iterator2> &
>>  operator =3D( const pair<typename iterator_traits<Iterator1>::value_typ=
e,
>>                         typename iterator_traits<Iterator2>::value_type>=
=20
>> & );
>>  iterator_pair<Iterator1, Iterator2> &
>>  operator =3D( pair<typename iterator_traits<Iterator1>::value_type,
>>                      typename iterator_traits<Iterator2>::value_type> &&=
=20
>> );
>>  iterator_pair<Iterator1, Iterator2> & operator *();
>>  iterator_pair<Iterator1, Iterator2> & operator ++();
>>  iterator_pair<Iterator1, Iterator2>   operator ++( int );
>> protected:
>>  iterator_type it;
>> };
>> template <class Iterator1, class Iterator2>
>> iterator_pair<Iterator1, Iterator2> make_iterator_pair( Iterator1,=20
>> Iterator2 );
>> template <class Iterator1, class Iterator2>
>> iterator_pair<Iterator1, Iterator2> make_iterator_pair( const=20
>> pair<Iterator1, Iterator2> & );
>> template <class Iterator1, class Iterator2>
>> iterator_pair<Iterator1, Iterator2> make_iterator_pair( pair<Iterator1,=
=20
>> Iterator2> && );
>> }
>> [/code]
>> =20
>>
>> =D3=D5=C2=C2=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 22:54:24 U=
TC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from=20
>> Moscow =CE=C1=D0=C9=D3=C1=CC:
>>
>>> Here is an outline of the iterator definition
>>> =20
>>> [code]
>>> namespace std
>>> {
>>> template <class Iterator1, class Iterator2>
>>> class iterator_pair : public iterator<output_iterator_tag, void, void,=
=20
>>> void, void>=20
>>> {
>>> public:
>>>  typedef pair<Iterator1, Iterator2> iterator_type;
>>>  iterator_pair( Iterator1, Iterator2 );
>>>  iterator_pair( pair<Iterator1, Iterator2> );
>>>  iterator_type base() const;
>>> =20
>>>  iterator_pair<Iterator1, Iterator2> &
>>>  operator =3D( const pair<typename iterator_traits<Iterator1>::value_ty=
pe,
>>>                         typename iterator_traits<Iterator2>::value_type=
>=20
>>> & );
>>>  iterator_pair<Iterator1, Iterator2> &
>>>  operator =3D( pair<typename iterator_traits<Iterator1>::value_type,
>>>                      typename iterator_traits<Iterator2>::value_type> &=
&=20
>>> );
>>>  iterator_pair<Iterator1, Iterator2> & operator *();
>>>  iterator_pair<Iterator1, Iterator2> & operator ++();
>>>  iterator_pair<Iterator1, Iterator2>   operator ++( int );
>>> protected:
>>>  iterator_type it;
>>> };
>>> template <class Iterator1, class Iterator2>
>>> iterator_pair<Iterator1, Iterator2> make_iterator_pair( Iterator1,=20
>>> Iterator2 );
>>> template <class Iterator1, class Iterator2>
>>> iterator_pair<Iterator1, Iterator2> make_iterator_pair( pair<Iterator1,=
=20
>>> Iterator2> );
>>> }
>>> [/code]
>>> =20
>>>
>>> =D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013 =C7., 17:49:27 =
UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from=20
>>> Moscow =CE=C1=D0=C9=D3=C1=CC:
>>>
>>>> Did anybody make a proposal about something as pair_iterator.
>>>> =20
>>>> As an idea: the pair_iterator incorporates two iterators and its=20
>>>> value_type is std::pair<typename Iterator1::value_type, typename=20
>>>> Iterator2::value_type> =20
>>>> =20
>>>> For example
>>>> =20
>>>> [code]
>>>> =20
>>>> const size_t N =3D 10;
>>>> int a[N], b[N], c[N], d[N];
>>>> =20
>>>> std::generate( std::begin( a ), std::end( a ), [] { return std::rand()=
=20
>>>> % N; } );
>>>> std::generate( std::begin( b ), std::end( b ), [] { return std::rand()=
=20
>>>> % N; } );
>>>> =20
>>>> std::transform( std::begin( a ), std::end( a ), std::begin( b ),=20
>>>>                         std::make_pair_iterator( c, d ),
>>>>                         std::minmax );
>>>> [/code]
>>>> =20
>>>> Array c is filled with minimum values of elements of arrays a and b=20
>>>> while array d is filled with maximumj values of elements of arrays a a=
nd b.
>>>>
>>> =20
>>>
>>>> Any feedback is appreciated.=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_2105_25718147.1380463271758
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>&nbsp;</div><div>I am sure that the fact that outer i=
terators do not provide to the outer world the actual type of the value_typ=
e of objects that they can deal&nbsp;with and instead of this they report i=
ncorrectly type void is a serious defect of the C++ Standard. </div><div>Th=
e actual value of the value_type is integral, unique and important characte=
ristic of any output iterator. An output iterator is not a Black Hole that =
can deal with any type of objects.</div><div>std::ostream_iterator has valu=
e_type&nbsp;that is the template parameter T. std::back_insert_iterator has=
 value_type that is typename Container::value_type. And so on. This informa=
tion shall be provided for the outer world. To provide instead of the actua=
l value type type void is a gross error.&nbsp;</div><div>&nbsp;</div><div>I=
 will prepare a defect report if there is no yet such a defect report.&nbsp=
;</div><div><br>=D7=CF=D3=CB=D2=C5=D3=C5=CE=D8=C5, 29 =D3=C5=CE=D4=D1=C2=D2=
=D1 2013&nbsp;=C7., 8:54:03 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad=
 from Moscow =CE=C1=D0=C9=D3=C1=CC:</div><blockquote class=3D"gmail_quote" =
style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: r=
gb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"><div =
dir=3D"ltr"><div>I tested my wonderfull iterator iterator_pair and it works=
 fine. For example</div><div>&nbsp;</div><div>[code]</div><div>std::map&lt;=
int, std::string&gt; m;</div><div>std::string s =3D "Hello new iterator \"s=
td::iterator_pair\"!";<br>std::istringstream is( s );</div><div>int i =3D 0=
;<br></div><div>std::transform( std::istream_iterator&lt;std::<wbr>string&g=
t;( is ),<br>&nbsp;&nbsp;std::istream_iterator&lt;std::<wbr>string&gt;(),<b=
r>&nbsp;&nbsp;std::inserter( m, m.begin() ), <br>&nbsp;&nbsp;[&amp;i]( cons=
t std::string &amp;s ) { return ( std::make_pair( i++, s ) ); } ); </div><d=
iv>&nbsp;</div><div>std::vector&lt;int&gt; v1( m.size() );<br>std::vector&l=
t;std::string&gt; v2( m.size() );<br></div><div>std::copy( m.begin(), m.end=
(), <br>&nbsp;usr::make_iterator_pair( v1.begin(), v2.begin() ) );</div><di=
v>&nbsp;</div><div>for ( int x : v1 ) std::cout &lt;&lt; x &lt;&lt; ' ';<br=
>std::cout &lt;&lt; std::endl;</div><div>&nbsp;</div><div>for ( const std::=
string &amp;s : v2 ) std::cout &lt;&lt; s &lt;&lt; ' ';<br>std::cout &lt;&l=
t; std::endl;<br></div><div>[/code]</div><div>&nbsp;</div><div>&nbsp;</div>=
<div>However it seems that I found a very serious defect of the C++ Standar=
d.</div><div>&nbsp;</div><div>If to change the code above the following way=
</div><div>&nbsp;</div><div>[code]</div><div>std::map&lt;int, std::string&g=
t; m;</div><div>std::string s =3D "Hello new iterator \"std::iterator_pair\=
"!";<br>std::istringstream is( s );</div><div>int i =3D 0;</div><div><br>st=
d::transform( std::istream_iterator&lt;std::<wbr>string&gt;( is ),<br>&nbsp=
;&nbsp;std::istream_iterator&lt;std::<wbr>string&gt;(),<br>&nbsp;&nbsp;std:=
:inserter( m, m.begin() ), <br>&nbsp;&nbsp;[&amp;i]( const std::string &amp=
;s ) { return ( std::make_pair( i++, s ) ); } ); </div><div>&nbsp;</div><di=
v>std::vector&lt;int&gt; v1;<br>std::vector&lt;std::string&gt; v2;</div><di=
v>v1.reserve( m.size() );<br>v2.reserve( m.size() );</div><div>&nbsp;</div>=
<div>std::copy( m.begin(), m.end(), <br>&nbsp;usr::make_iterator_pair( std:=
:back_inserter( v1 ), std::back_inserter( v2 ) ) );</div><div>&nbsp;</div><=
div>for ( int x : v1 ) std::cout &lt;&lt; x &lt;&lt; ' ';<br>std::cout &lt;=
&lt; std::endl;</div><div>&nbsp;</div><div>for ( const std::string &amp;s :=
 v2 ) std::cout &lt;&lt; s &lt;&lt; ' ';<br>std::cout &lt;&lt; std::endl;<b=
r>[/code]</div><div>&nbsp;</div><div>It will not be compiled. The problem i=
s that std::back_inserter is an output iterator and its value_type is defin=
ed as void. As the result I get std::pair&lt;void, void&gt;.</div><div>&nbs=
p;</div><div>Let's consider the following two iterators</div><div>&nbsp;</d=
iv><div>std::ostream_iterator&lt;std::<wbr>string&gt; it1( std::cout, "\n" =
);<br>std::ostream_iterator&lt;int&gt; it2( std::cout, "\n" );<br></div><di=
v>They are different though the both have the same template definitions. Wh=
at is the difference?</div><div>&nbsp;</div><div>You&nbsp;may write</div><d=
iv>&nbsp;</div><div>it1 =3D "abc";<br>it2 =3D 123;<br></div><div>but you ma=
y not write</div><div>&nbsp;</div><div><div>it1 =3D 123;<br>it2 =3D "abc";<=
/div><div>&nbsp;</div><div>What does this mean?</div><div>&nbsp;</div><div>=
It means that these two iterators have different value types! </div><div>An=
d as we see value type is an integral and important part of these iterators=
.. So these iterators have defined value types.</div><div>However in the C++=
 Standard they are defined such a way that their value_type is defined as v=
oid.</div><div>It is a serious defect of the standard. The value_type for o=
utput iterators shall not be defined as void because each output iterator i=
ncluding above mentioned and also std::back_insert_iterator, std::front_ins=
ert_iterator, and std::insert_iterator have concrete value types as I showe=
d in the example above with std::ostream_iterator.</div><div>&nbsp;</div><d=
iv>So each output iterator either shall have its defined value_type or retr=
anslate the value_type of an underlined iterator.</div><div>&nbsp;</div><di=
v>Let's consider another simple example.</div><div>&nbsp;</div><div>templat=
e &lt;OutputIterator&gt;</div><div>void SomeFunction( OutputIterator iterat=
or )</div><div>{</div><div>// some code</div><div>}</div><div>&nbsp;</div><=
div>And let's assume that we are going to define a variable inside the func=
tion body that will have the type that may be processed by iterator. As the=
 iterator has value_type void there is no possibility to determine the type=
 of the variable.</div><div>&nbsp;</div><div><div>template &lt;OutputIterat=
or&gt;</div><div>void SomeFunction( OutputIterator iterator )</div><div>{</=
div><div>WhatType? our_variable;</div><div>}</div><div>&nbsp;</div><div>I a=
m sure that all output iterators must have a concrete value_type that will =
differ from void.</div><br></div></div><div><br>=D7=CF=D3=CB=D2=C5=D3=C5=CE=
=D8=C5, 29 =D3=C5=CE=D4=D1=C2=D2=D1 2013&nbsp;=C7., 0:59:11 UTC+4 =D0=CF=CC=
=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow =CE=C1=D0=C9=D3=C1=CC:</div><b=
lockquote 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"><div>A revised version of the i=
terator definition</div><div>&nbsp;</div><div>[code]</div><div>namespace us=
r<br>{</div><div>template &lt;class Iterator1, class Iterator2&gt;<br>class=
 iterator_pair : public iterator&lt;output_iterator_tag, void, void, void, =
void&gt; <br>{<br>public:<br>&nbsp;typedef pair&lt;Iterator1, Iterator2&gt;=
&nbsp;iterator_type;</div><div>&nbsp;iterator_pair( Iterator1, Iterator2 );=
<br>&nbsp;explicit iterator_pair( const pair&lt;Iterator1, Iterator2&gt; &a=
mp; );<br>&nbsp;explicit iterator_pair( pair&lt;Iterator1, Iterator2&gt; &a=
mp;&amp; );</div><div>&nbsp;iterator_type base() const;<br>&nbsp;<br>&nbsp;=
iterator_pair&lt;Iterator1, Iterator2&gt; &amp;<br>&nbsp;operator =3D( cons=
t pair&lt;typename iterator_traits&lt;Iterator1&gt;::<wbr>value_type,<br>&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typename iter=
ator_traits&lt;Iterator2&gt;::<wbr>value_type&gt; &amp; );</div><div>&nbsp;=
iterator_pair&lt;Iterator1, Iterator2&gt; &amp;<br>&nbsp;operator =3D( pair=
&lt;typename iterator_traits&lt;Iterator1&gt;::<wbr>value_type,<br>&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typename iterator_traits&lt;Iterator2=
&gt;::<wbr>value_type&gt; &amp;&amp; );</div><div>&nbsp;iterator_pair&lt;It=
erator1, Iterator2&gt; &amp; operator *();<br>&nbsp;iterator_pair&lt;Iterat=
or1, Iterator2&gt; &amp; operator ++();<br>&nbsp;iterator_pair&lt;Iterator1=
, Iterator2&gt;&nbsp;&nbsp; operator ++( int );</div><div>protected:<br>&nb=
sp;iterator_type it;<br>};</div><div>template &lt;class Iterator1, class It=
erator2&gt;<br>iterator_pair&lt;Iterator1, Iterator2&gt; make_iterator_pair=
( Iterator1, Iterator2 );</div><div>template &lt;class Iterator1, class Ite=
rator2&gt;<br>iterator_pair&lt;Iterator1, Iterator2&gt; make_iterator_pair(=
 const pair&lt;Iterator1, Iterator2&gt; &amp; );</div><div>template &lt;cla=
ss Iterator1, class Iterator2&gt;<br>iterator_pair&lt;Iterator1, Iterator2&=
gt; make_iterator_pair( pair&lt;Iterator1, Iterator2&gt; &amp;&amp; );</div=
><div>}<br></div><div>[/code]</div><div>&nbsp;</div><div><br>=D3=D5=C2=C2=
=CF=D4=C1, 28 =D3=C5=CE=D4=D1=C2=D2=D1 2013&nbsp;=C7., 22:54:24 UTC+4 =D0=
=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from Moscow =CE=C1=D0=C9=D3=C1=CC:</=
div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; p=
adding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width:=
 1px; border-left-style: solid;"><div dir=3D"ltr"><div>Here is&nbsp;an outl=
ine of the iterator definition</div><div>&nbsp;</div><div>[code]</div><div>=
namespace std<br>{</div><div>template &lt;class Iterator1, class Iterator2&=
gt;</div><div>class iterator_pair : public iterator&lt;output_iterator_tag,=
 void, void, void, void&gt; <br>{<br>public:<br>&nbsp;typedef pair&lt;Itera=
tor1, Iterator2&gt;&nbsp;iterator_type;</div><div>&nbsp;iterator_pair( Iter=
ator1, Iterator2 );<br>&nbsp;iterator_pair( pair&lt;Iterator1, Iterator2&gt=
; );</div><div>&nbsp;iterator_type base() const;<br>&nbsp;<br>&nbsp;iterato=
r_pair&lt;Iterator1, Iterator2&gt; &amp;<br>&nbsp;operator =3D( const pair&=
lt;typename iterator_traits&lt;Iterator1&gt;::<wbr>value_type,<br>&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typename iterator_tr=
aits&lt;Iterator2&gt;::<wbr>value_type&gt; &amp; );</div><div>&nbsp;iterato=
r_pair&lt;Iterator1, Iterator2&gt; &amp;<br>&nbsp;operator =3D( pair&lt;typ=
ename iterator_traits&lt;Iterator1&gt;::<wbr>value_type,<br>&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typename iterator_traits&lt;Iterator2&gt;::<=
wbr>value_type&gt; &amp;&amp; );</div><div>&nbsp;iterator_pair&lt;Iterator1=
, Iterator2&gt; &amp; operator *();<br>&nbsp;iterator_pair&lt;Iterator1, It=
erator2&gt; &amp; operator ++();<br>&nbsp;iterator_pair&lt;Iterator1, Itera=
tor2&gt;&nbsp;&nbsp; operator ++( int );</div><div>protected:<br>&nbsp;iter=
ator_type it;<br>};</div><div>template &lt;class Iterator1, class Iterator2=
&gt;<br>iterator_pair&lt;Iterator1, Iterator2&gt; make_iterator_pair( Itera=
tor1, Iterator2 );</div><div>template &lt;class Iterator1, class Iterator2&=
gt;<br>iterator_pair&lt;Iterator1, Iterator2&gt; make_iterator_pair( pair&l=
t;Iterator1, Iterator2&gt; );</div><div>}<br></div><div>[/code]</div><div>&=
nbsp;</div><div><br>=D0=D1=D4=CE=C9=C3=C1, 27 =D3=C5=CE=D4=D1=C2=D2=D1 2013=
&nbsp;=C7., 17:49:27 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Vlad from M=
oscow =CE=C1=D0=C9=D3=C1=CC:</div><blockquote class=3D"gmail_quote" style=
=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(20=
4, 204, 204); border-left-width: 1px; border-left-style: solid;"><div dir=
=3D"ltr"><div>Did anybody make&nbsp;a proposal about something as pair_iter=
ator.</div><div>&nbsp;</div><div>As an idea: the pair_iterator incorporates=
 two iterators and its value_type is std::pair&lt;typename Iterator1::value=
_type, typename Iterator2::value_type&gt;&nbsp; </div><div>&nbsp;</div><div=
>For example</div><div>&nbsp;</div><div>[code]</div><div>&nbsp;</div><div>c=
onst size_t N =3D 10;</div><div>int a[N], b[N], c[N], d[N];</div><div>&nbsp=
;</div><div>std::generate( std::begin( a ), std::end( a ), [] { return std:=
:rand() % N; } );</div><div><div>std::generate( std::begin(&nbsp;b ), std::=
end(&nbsp;b ), [] { return std::rand() % N; } );</div><div>&nbsp;</div><div=
>std::transform( std::begin( a ), std::end( a ), std::begin( b ), </div><di=
v>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::make=
_pair_iterator( c, d ),</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp; std::minmax );</div><div>[/code]</div><div>&nbsp;</d=
iv><div>Array c is filled with minimum values of elements of arrays a and b=
 while array d is filled with maximumj values of elements of arrays a and b=
..</div><div></div></div></div></blockquote><div>&nbsp;</div><blockquote cla=
ss=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; b=
order-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-s=
tyle: solid;"><div dir=3D"ltr"><div><div>Any feedback is appreciated.&nbsp;=
</div></div></div></blockquote></div></blockquote></div></blockquote></div>=
</blockquote></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_2105_25718147.1380463271758--

.


Author: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@gmail.com>
Date: Sun, 29 Sep 2013 17:12:18 +0200
Raw View
2013/9/29 Vlad from Moscow <vlad.moscow@mail.ru>:
>
> I am sure that the fact that outer iterators do not provide to the outer
> world the actual type of the value_type of objects that they can deal with
> and instead of this they report incorrectly type void is a serious defect of
> the C++ Standard.

I disagree. It was essentially much more obvious that output iterators
may not have a single value type during the time when the library was
"conceptualized":

auto concept OutputIterator<typename X, typename Value> {
  requires Iterator<X>;
  typename reference = Iterator<X>::reference;
  typename postincrement_result = Iterator<X>::postincrement_result;
  requires SameType<reference, Iterator<X>::reference>
  && SameType<postincrement_result, Iterator<X>::postincrement_result>
  && Convertible<postincrement_result, const X&>
  && HasAssign<reference, Value>
  && HasAssign<HasDereference<postincrement_result>::result_type, Value>;
}

Even without language concepts, the standard is clear in
[iterator.requirements.general] (emphasis mine):

"All output iterators support the expression *i = o where o is a value
**of some type that is in the set of types** that are writable to the
particular iterator type of i."

> The actual value of the value_type is integral, unique and important
> characteristic of any output iterator.

You are mislead here according to the standard.

> An output iterator is not a Black
> Hole that can deal with any type of objects.

Well, it *may* not, but it *can* (depending on the actual output
iterator). Of-course it doesn't hold for e.g. out put iterators that
belong to the more refined iterator concepts, such as forward
iterator.

> std::ostream_iterator has value_type that is the template parameter T.
> std::back_insert_iterator has value_type that is typename
> Container::value_type. And so on.

You cannot prove the general case by enumerating some examples that
are special models.

- 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: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Sun, 29 Sep 2013 08:49:41 -0700 (PDT)
Raw View
------=_Part_31_12975567.1380469782013
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

=20
This statement
=20
"All output iterators support the expression *i =3D o where o is a value=20
**of some type that is in the set of types** that are writable to the=20
particular iterator type of i."=20
=20
does not prevent that an output iterator will have a well-formed=20
value_type. std::ostream_iterator, std::back_insert_iterator and other=20
insert iterators have and use implicitly defined value types. They only=20
confuse the outer world reporting the false information that their=20
value_type is void.
=20
And I demonstrated at least in three examples that it is simply a bug of=20
the Standard. There is no any reason that these iterators have to report=20
void type as the value_type. This only prevents to wriye  flexible=20
constructions.
=20
If you will suggest some output iterator that will deal with several value=
=20
types simultaneously then there is no problem. It is this iterator that=20
will decide what to report as its value_type.
=20
All iterators that have concrete value types shall report their value=20
types.instead of void. void is simply a gross error for these iterators. It=
=20
says that the iterator knows nothing about what types it may deals with. It=
=20
is a false assumption.
=20
=20

=D0=B2=D0=BE=D1=81=D0=BA=D1=80=D0=B5=D1=81=D0=B5=D0=BD=D1=8C=D0=B5, 29 =D1=
=81=D0=B5=D0=BD=D1=82=D1=8F=D0=B1=D1=80=D1=8F 2013 =D0=B3., 19:12:18 UTC+4 =
=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Da=
niel=20
Kr=C3=BCgler =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:

> 2013/9/29 Vlad from Moscow <vlad....@mail.ru <javascript:>>:=20
> >=20
> > I am sure that the fact that outer iterators do not provide to the oute=
r=20
> > world the actual type of the value_type of objects that they can deal=
=20
> with=20
> > and instead of this they report incorrectly type void is a serious=20
> defect of=20
> > the C++ Standard.=20
>
> I disagree. It was essentially much more obvious that output iterators=20
> may not have a single value type during the time when the library was=20
> "conceptualized":=20
>
> auto concept OutputIterator<typename X, typename Value> {=20
>   requires Iterator<X>;=20
>   typename reference =3D Iterator<X>::reference;=20
>   typename postincrement_result =3D Iterator<X>::postincrement_result;=20
>   requires SameType<reference, Iterator<X>::reference>=20
>   && SameType<postincrement_result, Iterator<X>::postincrement_result>=20
>   && Convertible<postincrement_result, const X&>=20
>   && HasAssign<reference, Value>=20
>   && HasAssign<HasDereference<postincrement_result>::result_type, Value>;=
=20
> }=20
>
> Even without language concepts, the standard is clear in=20
> [iterator.requirements.general] (emphasis mine):=20
>
> "All output iterators support the expression *i =3D o where o is a value=
=20
> **of some type that is in the set of types** that are writable to the=20
> particular iterator type of i."=20
>
> > The actual value of the value_type is integral, unique and important=20
> > characteristic of any output iterator.=20
>
> You are mislead here according to the standard.=20
>
> > An output iterator is not a Black=20
> > Hole that can deal with any type of objects.=20
>
> Well, it *may* not, but it *can* (depending on the actual output=20
> iterator). Of-course it doesn't hold for e.g. out put iterators that=20
> belong to the more refined iterator concepts, such as forward=20
> iterator.=20
>
> > std::ostream_iterator has value_type that is the template parameter T.=
=20
> > std::back_insert_iterator has value_type that is typename=20
> > Container::value_type. And so on.=20
>
> You cannot prove the general case by enumerating some examples that=20
> are special models.=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_31_12975567.1380469782013
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>&nbsp;</div><div>This statement</div><div>&nbsp;</div=
><div>"All output iterators support the expression *i =3D o where o is a va=
lue <br>**of some type that is in the set of types** that are writable to t=
he <br>particular iterator type of i." </div><div>&nbsp;</div><div>does not=
 prevent that an output iterator will have a well-formed value_type. std::o=
stream_iterator, std::back_insert_iterator and other insert iterators have =
and use implicitly defined value types. They only confuse the outer world r=
eporting the false information that their value_type is void.</div><div>&nb=
sp;</div><div>And I demonstrated at least in three examples that it is simp=
ly a bug of the Standard. There is no any reason that these iterators have =
to report void type as the value_type. This only prevents to wriye&nbsp; fl=
exible constructions.</div><div>&nbsp;</div><div>If you will suggest some o=
utput iterator that will deal with several value types simultaneously then =
there is no problem. It is this iterator that will decide what to report as=
 its value_type.</div><div>&nbsp;</div><div>All iterators that have concret=
e value types shall report their value types.instead of void. void is simpl=
y a gross error for these iterators. It says that the iterator knows nothin=
g about what types it may deals with. It is a false assumption.</div><div>&=
nbsp;</div><div>&nbsp;</div><div><br>=D0=B2=D0=BE=D1=81=D0=BA=D1=80=D0=B5=
=D1=81=D0=B5=D0=BD=D1=8C=D0=B5, 29 =D1=81=D0=B5=D0=BD=D1=82=D1=8F=D0=B1=D1=
=80=D1=8F 2013&nbsp;=D0=B3., 19:12:18 UTC+4 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=
=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Daniel Kr=C3=BCgler =D0=BD=D0=B0=
=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:</div><blockquote class=3D"gmail_quote" styl=
e=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(2=
04, 204, 204); border-left-width: 1px; border-left-style: solid;">2013/9/29=
 Vlad from Moscow &lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfusca=
ted-mailto=3D"JaztB_CVwsQJ">vlad....@mail.ru</a>&gt;:
<br>&gt;
<br>&gt; I am sure that the fact that outer iterators do not provide to the=
 outer
<br>&gt; world the actual type of the value_type of objects that they can d=
eal with
<br>&gt; and instead of this they report incorrectly type void is a serious=
 defect of
<br>&gt; the C++ Standard.
<br>
<br>I disagree. It was essentially much more obvious that output iterators
<br>may not have a single value type during the time when the library was
<br>"conceptualized":
<br>
<br>auto concept OutputIterator&lt;typename X, typename Value&gt; {
<br>&nbsp; requires Iterator&lt;X&gt;;
<br>&nbsp; typename reference =3D Iterator&lt;X&gt;::reference;
<br>&nbsp; typename postincrement_result =3D Iterator&lt;X&gt;::postincreme=
nt_<wbr>result;
<br>&nbsp; requires SameType&lt;reference, Iterator&lt;X&gt;::reference&gt;
<br>&nbsp; &amp;&amp; SameType&lt;postincrement_result, Iterator&lt;X&gt;::=
postincrement_<wbr>result&gt;
<br>&nbsp; &amp;&amp; Convertible&lt;postincrement_<wbr>result, const X&amp=
;&gt;
<br>&nbsp; &amp;&amp; HasAssign&lt;reference, Value&gt;
<br>&nbsp; &amp;&amp; HasAssign&lt;HasDereference&lt;<wbr>postincrement_res=
ult&gt;::result_<wbr>type, Value&gt;;
<br>}
<br>
<br>Even without language concepts, the standard is clear in
<br>[iterator.requirements.<wbr>general] (emphasis mine):
<br>
<br>"All output iterators support the expression *i =3D o where o is a valu=
e
<br>**of some type that is in the set of types** that are writable to the
<br>particular iterator type of i."
<br>
<br>&gt; The actual value of the value_type is integral, unique and importa=
nt
<br>&gt; characteristic of any output iterator.
<br>
<br>You are mislead here according to the standard.
<br>
<br>&gt; An output iterator is not a Black
<br>&gt; Hole that can deal with any type of objects.
<br>
<br>Well, it *may* not, but it *can* (depending on the actual output
<br>iterator). Of-course it doesn't hold for e.g. out put iterators that
<br>belong to the more refined iterator concepts, such as forward
<br>iterator.
<br>
<br>&gt; std::ostream_iterator has value_type that is the template paramete=
r T.
<br>&gt; std::back_insert_iterator has value_type that is typename
<br>&gt; Container::value_type. And so on.
<br>
<br>You cannot prove the general case by enumerating some examples that
<br>are special models.
<br>
<br>- Daniel
<br></blockquote></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_31_12975567.1380469782013--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Sun, 29 Sep 2013 09:18:39 -0700 (PDT)
Raw View
------=_Part_112_3506324.1380471520061
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

It is without controversy that std::ostream_iterator has value type T,=20
where T is its template parameter. Similarly std::back_insert_iterator has=
=20
value type typename Container::value_type. So there is no any reason that=
=20
they have to report type void as its value type instead of the actual value=
=20
type they use becasue it simply contradicts their realizations.
=20
The more information an iterator can provide  the better.
=20
At least you can use this information to write a conditional template code.=
=20
For example if an iterator has value type void you can write one function=
=20
or class specialization. If an iterator has value type that differs from=20
void you can write another function or class specialization.
=20
For example you can use this information in static_assert.
=20
All what you are saying in fact is the following. It can be somewhere in=20
the future that there will be a standard output iterator that will deal=20
with several value types simultaneously. And by this reason you prohibit=20
that iterators that have well-defined unique value types would report their=
=20
actual value types.=20
=20
A can not afree with such a logic. It is a destructive logic. it does not=
=20
help programmers.
=20
=20
=20
=20
=20

=D0=B2=D0=BE=D1=81=D0=BA=D1=80=D0=B5=D1=81=D0=B5=D0=BD=D1=8C=D0=B5, 29 =D1=
=81=D0=B5=D0=BD=D1=82=D1=8F=D0=B1=D1=80=D1=8F 2013 =D0=B3., 19:12:18 UTC+4 =
=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Da=
niel=20
Kr=C3=BCgler =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:

> 2013/9/29 Vlad from Moscow <vlad....@mail.ru <javascript:>>:=20
> >=20
> > I am sure that the fact that outer iterators do not provide to the oute=
r=20
> > world the actual type of the value_type of objects that they can deal=
=20
> with=20
> > and instead of this they report incorrectly type void is a serious=20
> defect of=20
> > the C++ Standard.=20
>
> I disagree. It was essentially much more obvious that output iterators=20
> may not have a single value type during the time when the library was=20
> "conceptualized":=20
>
> auto concept OutputIterator<typename X, typename Value> {=20
>   requires Iterator<X>;=20
>   typename reference =3D Iterator<X>::reference;=20
>   typename postincrement_result =3D Iterator<X>::postincrement_result;=20
>   requires SameType<reference, Iterator<X>::reference>=20
>   && SameType<postincrement_result, Iterator<X>::postincrement_result>=20
>   && Convertible<postincrement_result, const X&>=20
>   && HasAssign<reference, Value>=20
>   && HasAssign<HasDereference<postincrement_result>::result_type, Value>;=
=20
> }=20
>
> Even without language concepts, the standard is clear in=20
> [iterator.requirements.general] (emphasis mine):=20
>
> "All output iterators support the expression *i =3D o where o is a value=
=20
> **of some type that is in the set of types** that are writable to the=20
> particular iterator type of i."=20
>
> > The actual value of the value_type is integral, unique and important=20
> > characteristic of any output iterator.=20
>
> You are mislead here according to the standard.=20
>
> > An output iterator is not a Black=20
> > Hole that can deal with any type of objects.=20
>
> Well, it *may* not, but it *can* (depending on the actual output=20
> iterator). Of-course it doesn't hold for e.g. out put iterators that=20
> belong to the more refined iterator concepts, such as forward=20
> iterator.=20
>
> > std::ostream_iterator has value_type that is the template parameter T.=
=20
> > std::back_insert_iterator has value_type that is typename=20
> > Container::value_type. And so on.=20
>
> You cannot prove the general case by enumerating some examples that=20
> are special models.=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_112_3506324.1380471520061
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>It is without controversy that std::ostream_iterator =
has value type T, where T is its template parameter. Similarly std::back_in=
sert_iterator has value type typename Container::value_type. So there is no=
 any reason that they have to report type void as its value type instead of=
 the actual value type they use becasue it simply contradicts their realiza=
tions.</div><div>&nbsp;</div><div>The more information an iterator can prov=
ide&nbsp; the better.</div><div>&nbsp;</div><div>At least you can use this =
information to write a conditional template code. For example if an iterato=
r has value type void you can write one function or class specialization. I=
f an iterator has value type that differs from void you can write another f=
unction or class specialization.</div><div>&nbsp;</div><div>For example you=
 can use this information in static_assert.</div><div>&nbsp;</div><div>All =
what you are saying in fact is the following. It can be somewhere in the fu=
ture that there will be a standard output iterator that will deal with seve=
ral value types simultaneously. And by this reason you prohibit that iterat=
ors that have well-defined unique value types would report their actual val=
ue types. </div><div>&nbsp;</div><div>A can not afree with such a logic. It=
 is a destructive logic. it does not help programmers.</div><div>&nbsp;</di=
v><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>=
<br>=D0=B2=D0=BE=D1=81=D0=BA=D1=80=D0=B5=D1=81=D0=B5=D0=BD=D1=8C=D0=B5, 29 =
=D1=81=D0=B5=D0=BD=D1=82=D1=8F=D0=B1=D1=80=D1=8F 2013&nbsp;=D0=B3., 19:12:1=
8 UTC+4 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=
=D1=8C Daniel Kr=C3=BCgler =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:</div=
><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padd=
ing-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1p=
x; border-left-style: solid;">2013/9/29 Vlad from Moscow &lt;<a href=3D"jav=
ascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"JaztB_CVwsQJ">vlad....=
@mail.ru</a>&gt;:
<br>&gt;
<br>&gt; I am sure that the fact that outer iterators do not provide to the=
 outer
<br>&gt; world the actual type of the value_type of objects that they can d=
eal with
<br>&gt; and instead of this they report incorrectly type void is a serious=
 defect of
<br>&gt; the C++ Standard.
<br>
<br>I disagree. It was essentially much more obvious that output iterators
<br>may not have a single value type during the time when the library was
<br>"conceptualized":
<br>
<br>auto concept OutputIterator&lt;typename X, typename Value&gt; {
<br>&nbsp; requires Iterator&lt;X&gt;;
<br>&nbsp; typename reference =3D Iterator&lt;X&gt;::reference;
<br>&nbsp; typename postincrement_result =3D Iterator&lt;X&gt;::postincreme=
nt_<wbr>result;
<br>&nbsp; requires SameType&lt;reference, Iterator&lt;X&gt;::reference&gt;
<br>&nbsp; &amp;&amp; SameType&lt;postincrement_result, Iterator&lt;X&gt;::=
postincrement_<wbr>result&gt;
<br>&nbsp; &amp;&amp; Convertible&lt;postincrement_<wbr>result, const X&amp=
;&gt;
<br>&nbsp; &amp;&amp; HasAssign&lt;reference, Value&gt;
<br>&nbsp; &amp;&amp; HasAssign&lt;HasDereference&lt;<wbr>postincrement_res=
ult&gt;::result_<wbr>type, Value&gt;;
<br>}
<br>
<br>Even without language concepts, the standard is clear in
<br>[iterator.requirements.<wbr>general] (emphasis mine):
<br>
<br>"All output iterators support the expression *i =3D o where o is a valu=
e
<br>**of some type that is in the set of types** that are writable to the
<br>particular iterator type of i."
<br>
<br>&gt; The actual value of the value_type is integral, unique and importa=
nt
<br>&gt; characteristic of any output iterator.
<br>
<br>You are mislead here according to the standard.
<br>
<br>&gt; An output iterator is not a Black
<br>&gt; Hole that can deal with any type of objects.
<br>
<br>Well, it *may* not, but it *can* (depending on the actual output
<br>iterator). Of-course it doesn't hold for e.g. out put iterators that
<br>belong to the more refined iterator concepts, such as forward
<br>iterator.
<br>
<br>&gt; std::ostream_iterator has value_type that is the template paramete=
r T.
<br>&gt; std::back_insert_iterator has value_type that is typename
<br>&gt; Container::value_type. And so on.
<br>
<br>You cannot prove the general case by enumerating some examples that
<br>are special models.
<br>
<br>- Daniel
<br></blockquote></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_112_3506324.1380471520061--

.


Author: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Sun, 29 Sep 2013 10:03:45 -0700 (PDT)
Raw View
------=_Part_1556_4117284.1380474226020
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

As a note for example the proposed iterator std::iterator pair could have=
=20
the following code
=20
[code]
template <class Iterator1, class Iterator2>
class iterator_pair=20
 : public iterator<output_iterator_tag,=20
                   pair<typename iterator_traits<Iterator1>::value_type,=20
            typename iterator_traits<Iterator2>::value_type>,=20
       void,=20
       void,=20
       void>=20
{
static_assert( std::is_same<typename=20
iterator_traits<Iterator1>::value_type, void>::value ||
               std::is_same<typename=20
iterator_traits<Iterator2>::value_type, void>::value,
               "You may not use an iterator with value_type void" );
[/code]
=20
it would work fine if such  iterators as std::ostream_iterator,=20
std:;back_insert_iterator would report their actual value types.
=20
=20
=20
=D0=B2=D0=BE=D1=81=D0=BA=D1=80=D0=B5=D1=81=D0=B5=D0=BD=D1=8C=D0=B5, 29 =D1=
=81=D0=B5=D0=BD=D1=82=D1=8F=D0=B1=D1=80=D1=8F 2013 =D0=B3., 20:18:39 UTC+4 =
=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Vl=
ad from=20
Moscow =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:

> It is without controversy that std::ostream_iterator has value type T,=20
> where T is its template parameter. Similarly std::back_insert_iterator ha=
s=20
> value type typename Container::value_type. So there is no any reason that=
=20
> they have to report type void as its value type instead of the actual val=
ue=20
> type they use becasue it simply contradicts their realizations.
> =20
> The more information an iterator can provide  the better.
> =20
> At least you can use this information to write a conditional template=20
> code. For example if an iterator has value type void you can write one=20
> function or class specialization. If an iterator has value type that=20
> differs from void you can write another function or class specialization.
> =20
> For example you can use this information in static_assert.
> =20
> All what you are saying in fact is the following. It can be somewhere in=
=20
> the future that there will be a standard output iterator that will deal=
=20
> with several value types simultaneously. And by this reason you prohibit=
=20
> that iterators that have well-defined unique value types would report the=
ir=20
> actual value types.=20
> =20
> A can not afree with such a logic. It is a destructive logic. it does not=
=20
> help programmers.
> =20
> =20
> =20
> =20
> =20
>
> =D0=B2=D0=BE=D1=81=D0=BA=D1=80=D0=B5=D1=81=D0=B5=D0=BD=D1=8C=D0=B5, 29 =
=D1=81=D0=B5=D0=BD=D1=82=D1=8F=D0=B1=D1=80=D1=8F 2013 =D0=B3., 19:12:18 UTC=
+4 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=
 Daniel=20
> Kr=C3=BCgler =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
>> 2013/9/29 Vlad from Moscow <vlad....@mail.ru>:=20
>> >=20
>> > I am sure that the fact that outer iterators do not provide to the=20
>> outer=20
>> > world the actual type of the value_type of objects that they can deal=
=20
>> with=20
>> > and instead of this they report incorrectly type void is a serious=20
>> defect of=20
>> > the C++ Standard.=20
>>
>> I disagree. It was essentially much more obvious that output iterators=
=20
>> may not have a single value type during the time when the library was=20
>> "conceptualized":=20
>>
>> auto concept OutputIterator<typename X, typename Value> {=20
>>   requires Iterator<X>;=20
>>   typename reference =3D Iterator<X>::reference;=20
>>   typename postincrement_result =3D Iterator<X>::postincrement_result;=
=20
>>   requires SameType<reference, Iterator<X>::reference>=20
>>   && SameType<postincrement_result, Iterator<X>::postincrement_result>=
=20
>>   && Convertible<postincrement_result, const X&>=20
>>   && HasAssign<reference, Value>=20
>>   && HasAssign<HasDereference<postincrement_result>::result_type, Value>=
;=20
>> }=20
>>
>> Even without language concepts, the standard is clear in=20
>> [iterator.requirements.general] (emphasis mine):=20
>>
>> "All output iterators support the expression *i =3D o where o is a value=
=20
>> **of some type that is in the set of types** that are writable to the=20
>> particular iterator type of i."=20
>>
>> > The actual value of the value_type is integral, unique and important=
=20
>> > characteristic of any output iterator.=20
>>
>> You are mislead here according to the standard.=20
>>
>> > An output iterator is not a Black=20
>> > Hole that can deal with any type of objects.=20
>>
>> Well, it *may* not, but it *can* (depending on the actual output=20
>> iterator). Of-course it doesn't hold for e.g. out put iterators that=20
>> belong to the more refined iterator concepts, such as forward=20
>> iterator.=20
>>
>> > std::ostream_iterator has value_type that is the template parameter T.=
=20
>> > std::back_insert_iterator has value_type that is typename=20
>> > Container::value_type. And so on.=20
>>
>> You cannot prove the general case by enumerating some examples that=20
>> are special models.=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_1556_4117284.1380474226020
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>As a note for example the proposed iterator std::iter=
ator pair could have the following code</div><div>&nbsp;</div><div>[code]</=
div><div>template &lt;class Iterator1, class Iterator2&gt;<br>class iterato=
r_pair <br>&nbsp;: public iterator&lt;output_iterator_tag, <br>&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; pair&lt;typename iterator_traits&lt;Iterator1&gt;::va=
lue_type, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; typename iterator_traits&lt;Iterator2&gt;::value_type&gt;, <br>&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; void, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void&gt; <br>{<br>static_=
assert( std::is_same&lt;typename iterator_traits&lt;Iterator1&gt;::value_ty=
pe, void&gt;::value ||<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::is_same&lt;typename iterator_trait=
s&lt;Iterator2&gt;::value_type, void&gt;::value,<br>&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "You may not =
use an iterator with value_type void" );<br></div><div>[/code]</div><div>&n=
bsp;</div><div>it would work fine if such&nbsp; iterators as std::ostream_i=
terator, std:;back_insert_iterator would report their actual value types.</=
div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div><div>=D0=B2=D0=
=BE=D1=81=D0=BA=D1=80=D0=B5=D1=81=D0=B5=D0=BD=D1=8C=D0=B5, 29 =D1=81=D0=B5=
=D0=BD=D1=82=D1=8F=D0=B1=D1=80=D1=8F 2013&nbsp;=D0=B3., 20:18:39 UTC+4 =D0=
=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Vlad =
from Moscow =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:</div></div><blockqu=
ote 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"><div>It is without controversy that s=
td::ostream_iterator has value type T, where T is its template parameter. S=
imilarly std::back_insert_iterator has value type typename Container::value=
_type. So there is no any reason that they have to report type void as its =
value type instead of the actual value type they use becasue it simply cont=
radicts their realizations.</div><div>&nbsp;</div><div>The more information=
 an iterator can provide&nbsp; the better.</div><div>&nbsp;</div><div>At le=
ast you can use this information to write a conditional template code. For =
example if an iterator has value type void you can write one function or cl=
ass specialization. If an iterator has value type that differs from void yo=
u can write another function or class specialization.</div><div>&nbsp;</div=
><div>For example you can use this information in static_assert.</div><div>=
&nbsp;</div><div>All what you are saying in fact is the following. It can b=
e somewhere in the future that there will be a standard output iterator tha=
t will deal with several value types simultaneously. And by this reason you=
 prohibit that iterators that have well-defined unique value types would re=
port their actual value types. </div><div>&nbsp;</div><div>A can not afree =
with such a logic. It is a destructive logic. it does not help programmers.=
</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><=
div>&nbsp;</div><div><br>=D0=B2=D0=BE=D1=81=D0=BA=D1=80=D0=B5=D1=81=D0=B5=
=D0=BD=D1=8C=D0=B5, 29 =D1=81=D0=B5=D0=BD=D1=82=D1=8F=D0=B1=D1=80=D1=8F 201=
3&nbsp;=D0=B3., 19:12:18 UTC+4 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=
=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Daniel Kr=C3=BCgler =D0=BD=D0=B0=D0=BF=D0=B8=
=D1=81=D0=B0=D0=BB:</div><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;">2013/9/29 Vlad from M=
oscow &lt;<a>vlad....@mail.ru</a>&gt;:
<br>&gt;
<br>&gt; I am sure that the fact that outer iterators do not provide to the=
 outer
<br>&gt; world the actual type of the value_type of objects that they can d=
eal with
<br>&gt; and instead of this they report incorrectly type void is a serious=
 defect of
<br>&gt; the C++ Standard.
<br>
<br>I disagree. It was essentially much more obvious that output iterators
<br>may not have a single value type during the time when the library was
<br>"conceptualized":
<br>
<br>auto concept OutputIterator&lt;typename X, typename Value&gt; {
<br>&nbsp; requires Iterator&lt;X&gt;;
<br>&nbsp; typename reference =3D Iterator&lt;X&gt;::reference;
<br>&nbsp; typename postincrement_result =3D Iterator&lt;X&gt;::postincreme=
nt_<wbr>result;
<br>&nbsp; requires SameType&lt;reference, Iterator&lt;X&gt;::reference&gt;
<br>&nbsp; &amp;&amp; SameType&lt;postincrement_result, Iterator&lt;X&gt;::=
postincrement_<wbr>result&gt;
<br>&nbsp; &amp;&amp; Convertible&lt;postincrement_<wbr>result, const X&amp=
;&gt;
<br>&nbsp; &amp;&amp; HasAssign&lt;reference, Value&gt;
<br>&nbsp; &amp;&amp; HasAssign&lt;HasDereference&lt;<wbr>postincrement_res=
ult&gt;::result_<wbr>type, Value&gt;;
<br>}
<br>
<br>Even without language concepts, the standard is clear in
<br>[iterator.requirements.<wbr>general] (emphasis mine):
<br>
<br>"All output iterators support the expression *i =3D o where o is a valu=
e
<br>**of some type that is in the set of types** that are writable to the
<br>particular iterator type of i."
<br>
<br>&gt; The actual value of the value_type is integral, unique and importa=
nt
<br>&gt; characteristic of any output iterator.
<br>
<br>You are mislead here according to the standard.
<br>
<br>&gt; An output iterator is not a Black
<br>&gt; Hole that can deal with any type of objects.
<br>
<br>Well, it *may* not, but it *can* (depending on the actual output
<br>iterator). Of-course it doesn't hold for e.g. out put iterators that
<br>belong to the more refined iterator concepts, such as forward
<br>iterator.
<br>
<br>&gt; std::ostream_iterator has value_type that is the template paramete=
r T.
<br>&gt; std::back_insert_iterator has value_type that is typename
<br>&gt; Container::value_type. And so on.
<br>
<br>You cannot prove the general case by enumerating some examples that
<br>are special models.
<br>
<br>- Daniel
<br></blockquote></div></blockquote></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_1556_4117284.1380474226020--

.


Author: Mathias Gaunard <mathias.gaunard@ens-lyon.org>
Date: Fri, 27 Sep 2013 19:10:20 +0200
Raw View
On 27/09/13 16:03, Zhihao Yuan wrote:

> Boost has zip_iterator
>
>    http://www.boost.org/doc/libs/1_54_0/libs/iterator/doc/zip_iterator.html
>
> And we shortly discussed whether we should try to standardize it.
> The major blocker is the current iterator category does not allow
> arbitrary proxy iterator.

I suppose that kind of thing is discussed as part of SG9 (Ranges)?

In Boost, the range interface and the iterator interface for this
functionality is not consistent. I'd like to see a good approach between
the iterator and range versions of all generators and adaptors.

--

---
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: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Sat, 25 Apr 2015 00:30:18 -0700 (PDT)
Raw View
------=_Part_1875_1517943877.1429947019096
Content-Type: multipart/alternative;
 boundary="----=_Part_1876_2124498026.1429947019096"

------=_Part_1876_2124498026.1429947019096
Content-Type: text/plain; charset=UTF-8

I described the iterator adapter in my article in the issue of ACCU
Overload N126 (April, 2015).

It is named "iterator_pair - A Simple and Useful Iterator Adapter".

You can read it either in the pdf format at this address
<http://accu.org/var/uploads/journals/Overload126.pdf> or at iscpp.org
<https://isocpp.org/blog/2015/04/overload-126-is-now-available>

The articles also points to a serious defect of standard algorithms
std::partial_sum and std::adjacent_difference and shows how to remedy it.

On Friday, September 27, 2013 at 5:49:27 PM UTC+4, Vlad from Moscow wrote:

> Did anybody make a proposal about something as pair_iterator.
>
> As an idea: the pair_iterator incorporates two iterators and its
> value_type is std::pair<typename Iterator1::value_type, typename
> Iterator2::value_type>
>
> For example
>
> [code]
>
> const size_t N = 10;
> int a[N], b[N], c[N], d[N];
>
> std::generate( std::begin( a ), std::end( a ), [] { return std::rand() %
> N; } );
> std::generate( std::begin( b ), std::end( b ), [] { return std::rand() %
> N; } );
>
> std::transform( std::begin( a ), std::end( a ), std::begin( b ),
>                         std::make_pair_iterator( c, d ),
>                         std::minmax );
> [/code]
>
> Array c is filled with minimum values of elements of arrays a and b while
> array d is filled with maximumj values of elements of arrays a and b.
>
>

--

---
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_1876_2124498026.1429947019096
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I described the iterator adapter in my article in the=
 issue of ACCU Overload N126 (April, 2015).</div><div><br></div><div>It is =
named "iterator_pair - A Simple and Useful Iterator Adapter".</div><div><br=
></div><div>You can read it either in the pdf format at <a href=3D"http://a=
ccu.org/var/uploads/journals/Overload126.pdf">this address</a>&nbsp;or at <=
a href=3D"https://isocpp.org/blog/2015/04/overload-126-is-now-available">is=
cpp.org</a></div><div><br></div><div>The articles also points to a serious =
defect of standard algorithms std::partial_sum and std::adjacent_difference=
 and shows how to remedy it.<br><br>On Friday, September 27, 2013 at 5:49:2=
7 PM UTC+4, Vlad from Moscow wrote:</div><blockquote class=3D"gmail_quote" =
style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: r=
gb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"><div =
dir=3D"ltr"><div>Did anybody make&nbsp;a proposal about something as pair_i=
terator.</div><div>&nbsp;</div><div>As an idea: the pair_iterator incorpora=
tes two iterators and its value_type is std::pair&lt;typename Iterator1::va=
lue_type, typename Iterator2::value_type&gt;&nbsp; </div><div>&nbsp;</div><=
div>For example</div><div>&nbsp;</div><div>[code]</div><div>&nbsp;</div><di=
v>const size_t N =3D 10;</div><div>int a[N], b[N], c[N], d[N];</div><div>&n=
bsp;</div><div>std::generate( std::begin( a ), std::end( a ), [] { return s=
td::rand() % N; } );</div><div><div>std::generate( std::begin(&nbsp;b ), st=
d::end(&nbsp;b ), [] { return std::rand() % N; } );</div><div>&nbsp;</div><=
div>std::transform( std::begin( a ), std::end( a ), std::begin( b ), </div>=
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::m=
ake_pair_iterator( c, d ),</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; std::minmax );</div><div>[/code]</div><div>&nbsp;=
</div><div>Array c is filled with minimum values of elements of arrays a an=
d b while array d is filled with maximumj values of elements of arrays a an=
d b.</div><div>&nbsp;</div></div></div></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_1876_2124498026.1429947019096--
------=_Part_1875_1517943877.1429947019096--

.


Author: "'Jeffrey Yasskin' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Sun, 26 Apr 2015 20:47:56 -0700
Raw View
This is http://www.boost.org/doc/libs/1_58_0/libs/iterator/doc/zip_iterator.html,
right?

On Sat, Apr 25, 2015 at 12:30 AM, Vlad from Moscow <vlad.moscow@mail.ru> wrote:
> I described the iterator adapter in my article in the issue of ACCU Overload
> N126 (April, 2015).
>
> It is named "iterator_pair - A Simple and Useful Iterator Adapter".
>
> You can read it either in the pdf format at this address or at iscpp.org
>
> The articles also points to a serious defect of standard algorithms
> std::partial_sum and std::adjacent_difference and shows how to remedy it.
>
> On Friday, September 27, 2013 at 5:49:27 PM UTC+4, Vlad from Moscow wrote:
>>
>> Did anybody make a proposal about something as pair_iterator.
>>
>> As an idea: the pair_iterator incorporates two iterators and its
>> value_type is std::pair<typename Iterator1::value_type, typename
>> Iterator2::value_type>
>>
>> For example
>>
>> [code]
>>
>> const size_t N = 10;
>> int a[N], b[N], c[N], d[N];
>>
>> std::generate( std::begin( a ), std::end( a ), [] { return std::rand() %
>> N; } );
>> std::generate( std::begin( b ), std::end( b ), [] { return std::rand() %
>> N; } );
>>
>> std::transform( std::begin( a ), std::end( a ), std::begin( b ),
>>                         std::make_pair_iterator( c, d ),
>>                         std::minmax );
>> [/code]
>>
>> Array c is filled with minimum values of elements of arrays a and b while
>> array d is filled with maximumj values of elements of arrays a and b.
>>
>
> --
>
> ---
> 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/.

--

---
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: Vlad from Moscow <vlad.moscow@mail.ru>
Date: Mon, 27 Apr 2015 01:14:59 -0700 (PDT)
Raw View
------=_Part_3870_1324584976.1430122499739
Content-Type: multipart/alternative;
 boundary="----=_Part_3871_1484206830.1430122499739"

------=_Part_3871_1484206830.1430122499739
Content-Type: text/plain; charset=UTF-8

Jeffrey, they are different. I hope it is seen from thr article. The notion
of pair is a magic notion in standard algorithms and containers. This
iterator adapter is very simple and at the same time useful. It can find a
usa for many tasks. And it is logically consistent with the notion of pair.

On Monday, April 27, 2015 at 6:48:18 AM UTC+3, Jeffrey Yasskin wrote:
>
> This is
> http://www.boost.org/doc/libs/1_58_0/libs/iterator/doc/zip_iterator.html,
> right?
>
> On Sat, Apr 25, 2015 at 12:30 AM, Vlad from Moscow <vlad....@mail.ru
> <javascript:>> wrote:
> > I described the iterator adapter in my article in the issue of ACCU
> Overload
> > N126 (April, 2015).
> >
> > It is named "iterator_pair - A Simple and Useful Iterator Adapter".
> >
> > You can read it either in the pdf format at this address or at iscpp.org
> >
> > The articles also points to a serious defect of standard algorithms
> > std::partial_sum and std::adjacent_difference and shows how to remedy
> it.
> >
> > On Friday, September 27, 2013 at 5:49:27 PM UTC+4, Vlad from Moscow
> wrote:
> >>
> >> Did anybody make a proposal about something as pair_iterator.
> >>
> >> As an idea: the pair_iterator incorporates two iterators and its
> >> value_type is std::pair<typename Iterator1::value_type, typename
> >> Iterator2::value_type>
> >>
> >> For example
> >>
> >> [code]
> >>
> >> const size_t N = 10;
> >> int a[N], b[N], c[N], d[N];
> >>
> >> std::generate( std::begin( a ), std::end( a ), [] { return std::rand()
> %
> >> N; } );
> >> std::generate( std::begin( b ), std::end( b ), [] { return std::rand()
> %
> >> N; } );
> >>
> >> std::transform( std::begin( a ), std::end( a ), std::begin( b ),
> >>                         std::make_pair_iterator( c, d ),
> >>                         std::minmax );
> >> [/code]
> >>
> >> Array c is filled with minimum values of elements of arrays a and b
> while
> >> array d is filled with maximumj values of elements of arrays a and b.
> >>
> >
> > --
> >
> > ---
> > 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-proposal...@isocpp.org <javascript:>.
> > To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>
> > Visit this group at
> > http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
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_3871_1484206830.1430122499739
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Jeffrey, they are different. I hope it is seen from thr ar=
ticle. The notion of pair is a magic notion in standard algorithms and cont=
ainers. This iterator adapter is very simple and at the same time useful.&n=
bsp;It&nbsp;can find&nbsp;a usa&nbsp;for many tasks. And it is logically co=
nsistent with the notion of pair.<br><br>On Monday, April 27, 2015 at 6:48:=
18 AM UTC+3, Jeffrey Yasskin wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(20=
4, 204, 204); border-left-width: 1px; border-left-style: solid;">This is <a=
 onmousedown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fwww=
..boost.org%2Fdoc%2Flibs%2F1_58_0%2Flibs%2Fiterator%2Fdoc%2Fzip_iterator.htm=
l\46sa\75D\46sntz\0751\46usg\75AFQjCNEQqjJ-M_ypbKGkIwFDDQzoKq09sA';return t=
rue;" onclick=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fww=
w.boost.org%2Fdoc%2Flibs%2F1_58_0%2Flibs%2Fiterator%2Fdoc%2Fzip_iterator.ht=
ml\46sa\75D\46sntz\0751\46usg\75AFQjCNEQqjJ-M_ypbKGkIwFDDQzoKq09sA';return =
true;" href=3D"http://www.boost.org/doc/libs/1_58_0/libs/iterator/doc/zip_i=
terator.html" target=3D"_blank" rel=3D"nofollow">http://www.boost.org/doc/l=
ibs/<wbr>1_58_0/libs/iterator/doc/zip_<wbr>iterator.html</a>,
<br>right?
<br>
<br>On Sat, Apr 25, 2015 at 12:30 AM, Vlad from Moscow &lt;<a onmousedown=
=3D"this.href=3D'javascript:';return true;" onclick=3D"this.href=3D'javascr=
ipt:';return true;" href=3D"javascript:" target=3D"_blank" rel=3D"nofollow"=
 gdf-obfuscated-mailto=3D"4o2N5Evc54gJ">vlad....@mail.ru</a>&gt; wrote:
<br>&gt; I described the iterator adapter in my article in the issue of ACC=
U Overload
<br>&gt; N126 (April, 2015).
<br>&gt;
<br>&gt; It is named "iterator_pair - A Simple and Useful Iterator Adapter"=
..
<br>&gt;
<br>&gt; You can read it either in the pdf format at this address or at <a =
onmousedown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fiscp=
p.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFynTbNHvNdM20suIsCnUH-sIGvzQ';retu=
rn true;" onclick=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%=
2Fiscpp.org\46sa\75D\46sntz\0751\46usg\75AFQjCNFynTbNHvNdM20suIsCnUH-sIGvzQ=
';return true;" href=3D"http://iscpp.org" target=3D"_blank" rel=3D"nofollow=
">iscpp.org</a>
<br>&gt;
<br>&gt; The articles also points to a serious defect of standard algorithm=
s
<br>&gt; std::partial_sum and std::adjacent_difference and shows how to rem=
edy it.
<br>&gt;
<br>&gt; On Friday, September 27, 2013 at 5:49:27 PM UTC+4, Vlad from Mosco=
w wrote:
<br>&gt;&gt;
<br>&gt;&gt; Did anybody make a proposal about something as pair_iterator.
<br>&gt;&gt;
<br>&gt;&gt; As an idea: the pair_iterator incorporates two iterators and i=
ts
<br>&gt;&gt; value_type is std::pair&lt;typename Iterator1::value_type, typ=
ename
<br>&gt;&gt; Iterator2::value_type&gt;
<br>&gt;&gt;
<br>&gt;&gt; For example
<br>&gt;&gt;
<br>&gt;&gt; [code]
<br>&gt;&gt;
<br>&gt;&gt; const size_t N =3D 10;
<br>&gt;&gt; int a[N], b[N], c[N], d[N];
<br>&gt;&gt;
<br>&gt;&gt; std::generate( std::begin( a ), std::end( a ), [] { return std=
::rand() %
<br>&gt;&gt; N; } );
<br>&gt;&gt; std::generate( std::begin( b ), std::end( b ), [] { return std=
::rand() %
<br>&gt;&gt; N; } );
<br>&gt;&gt;
<br>&gt;&gt; std::transform( std::begin( a ), std::end( a ), std::begin( b =
),
<br>&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
 &nbsp; &nbsp; &nbsp; std::make_pair_iterator( c, d ),
<br>&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
 &nbsp; &nbsp; &nbsp; std::minmax );
<br>&gt;&gt; [/code]
<br>&gt;&gt;
<br>&gt;&gt; Array c is filled with minimum values of elements of arrays a =
and b while
<br>&gt;&gt; array d is filled with maximumj values of elements of arrays a=
 and b.
<br>&gt;&gt;
<br>&gt;
<br>&gt; --
<br>&gt;
<br>&gt; ---
<br>&gt; You received this message because you are subscribed to the Google=
 Groups
<br>&gt; "ISO C++ Standard - Future Proposals" group.
<br>&gt; To unsubscribe from this group and stop receiving emails from it, =
send an
<br>&gt; email to <a onmousedown=3D"this.href=3D'javascript:';return true;"=
 onclick=3D"this.href=3D'javascript:';return true;" href=3D"javascript:" ta=
rget=3D"_blank" rel=3D"nofollow" gdf-obfuscated-mailto=3D"4o2N5Evc54gJ">std=
-proposal...@<wbr>isocpp.org</a>.
<br>&gt; To post to this group, send email to <a onmousedown=3D"this.href=
=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:';return =
true;" href=3D"javascript:" target=3D"_blank" rel=3D"nofollow" gdf-obfuscat=
ed-mailto=3D"4o2N5Evc54gJ">std-pr...@isocpp.org</a>.
<br>&gt; Visit this group at
<br>&gt; <a onmousedown=3D"this.href=3D'http://groups.google.com/a/isocpp.o=
rg/group/std-proposals/';return true;" onclick=3D"this.href=3D'http://group=
s.google.com/a/isocpp.org/group/std-proposals/';return true;" href=3D"http:=
//groups.google.com/a/isocpp.org/group/std-proposals/" target=3D"_blank" re=
l=3D"nofollow">http://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>pr=
oposals/</a>.
<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_3871_1484206830.1430122499739--
------=_Part_3870_1324584976.1430122499739--

.