220 6752 <79b31f45-f3dc-4bc8-bc1e-8f33e7c190e8@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Vlad from Moscow <vlad.moscow@mail.ru>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: pair_iterator
Date: Sat, 28 Sep 2013 21:54:03 -0700 (PDT)
Lines: 454
Approved: news@gmane.org
Message-ID: <79b31f45-f3dc-4bc8-bc1e-8f33e7c190e8@isocpp.org>
References: <7498d5e4-4933-4890-854c-9bf998268cc1@isocpp.org>
 <ac4878ba-cdc5-42af-be98-9e024a0a7976@isocpp.org>
 <70662a4d-21e1-4705-bb69-e99dfde5ee90@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_1278_6319418.1380430443838"
X-Trace: ger.gmane.org 1380430445 18541 80.91.229.3 (29 Sep 2013 04:54:05 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 29 Sep 2013 04:54:05 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCXLLRHD7IDRB3PET2JAKGQEGJNDVOI@isocpp.org Sun Sep 29 06:54:09 2013
Return-path: <std-proposals+bncBCXLLRHD7IDRB3PET2JAKGQEGJNDVOI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oa0-f69.google.com ([209.85.219.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCXLLRHD7IDRB3PET2JAKGQEGJNDVOI@isocpp.org>)
	id 1VQ91D-0006qD-F6
	for gclcip-std-proposals@m.gmane.org; Sun, 29 Sep 2013 06:54:07 +0200
Original-Received: by mail-oa0-f69.google.com with SMTP id n10sf13477563oag.4
        for <gclcip-std-proposals@m.gmane.org>; Sat, 28 Sep 2013 21:54:06 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=Lyd13cT1NEn8EG1bnLgMMBQj2OgVZNEEuLFoTo58f0I=;
        b=BVGksnJsNPr+anNTQQ+Z5jb4pE+FbTlvvexxLgKzy04OzPU51fx5e+rlpECkpfpWgW
         jJt3oYMt3epeNaeSArMX9J5MppNbYHyr1vyzgWOQT6KVgpBCXBUPxLDnC4PBUrTJdJ5F
         lXD+XLviLZROtkF/29QrslOR4FhfCmK5nyZA0Xc3+wCklUv+zo2wrcOxxVVuKEjiO318
         Hf1pqEZIvYFXO8SNHqA4QENthu6/vO1/RZcZok/dsc3guOiIvs1j7InL+ikTXMIxZqsR
         kxkznpiVsv9p1Sw0Y2P54EdxtYuoagm7AnKDMVrArMm4FBLqMXqg4ajklaK2DwiEuITA
         jJbQ==
X-Received: by 10.43.154.8 with SMTP id lc8mr9326939icc.16.1380430446247;
        Sat, 28 Sep 2013 21:54:06 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.122.74 with SMTP id lq10ls1216970igb.36.canary; Sat, 28 Sep
 2013 21:54:05 -0700 (PDT)
X-Received: by 10.50.16.111 with SMTP id f15mr312547igd.2.1380430445557;
        Sat, 28 Sep 2013 21:54:05 -0700 (PDT)
In-Reply-To: <70662a4d-21e1-4705-bb69-e99dfde5ee90@isocpp.org>
X-Original-Sender: vlad.moscow@mail.ru
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:6752
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/6752>

------=_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--

.
