220 5257 <7d8a2d85-0995-4833-ad0c-75577f293b63@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: asaelr@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Some thoughts about coroutines
Date: Thu, 27 Jun 2013 07:34:39 -0700 (PDT)
Lines: 1512
Approved: news@gmane.org
Message-ID: <7d8a2d85-0995-4833-ad0c-75577f293b63@isocpp.org>
References: <e4828fad-0428-46f8-ad6d-500848c2212b@isocpp.org>
 <291db835-d42d-40cd-8760-47cdf327680d@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_482_15419926.1372343679497"
X-Trace: ger.gmane.org 1372343683 29191 80.91.229.3 (27 Jun 2013 14:34:43 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 27 Jun 2013 14:34:43 +0000 (UTC)
Cc: asaelr@gmail.com
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB23LHRZUKRBAE3WGHAKGQEQRK7ZGA@isocpp.org Thu Jun 27 16:34:45 2013
Return-path: <std-proposals+bncBCB23LHRZUKRBAE3WGHAKGQEQRK7ZGA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-gh0-f197.google.com ([209.85.160.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCB23LHRZUKRBAE3WGHAKGQEQRK7ZGA@isocpp.org>)
	id 1UsDHV-00079q-Qm
	for gclcip-std-proposals@m.gmane.org; Thu, 27 Jun 2013 16:34:42 +0200
Original-Received: by mail-gh0-f197.google.com with SMTP id r20sf1066157ghr.0
        for <gclcip-std-proposals@m.gmane.org>; Thu, 27 Jun 2013 07:34:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-beenthere:date:from:to:cc:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-google-group-id:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe:content-type;
        bh=/2lCXBMxuzfarRe0lcYynOwJ+X4Ef+naR6a0AjX4Ojs=;
        b=pO5Q5XsqgHxKKkN1dgt0u4YL8HWipQD/Xp5AeSGguqrmstTAJz5rQq/GJwzgyVtsZr
         HKr/fdwm+KJ7SxtQgF3ohWRI06oecFCkzY2PvI7CBP3o88XAxIIu/NYhPyp13RaVcw8s
         CD/KFNkBhwRddq+4voosDFUR8mo0HLh1yRD9Bj/CH9JJVU3FrELO+G10K39aTxJCrC6m
         fNaK+PIcEZZFQiGb13EP0YR+XH08eMbZvDspk+l6a0K6G1C3t8b4hnkE45S6HdX5eA+/
         utAm+zKta+LxjyHtxfk8akLQCqPSyDEXtEyjSJz3eae4xwlbNvQNWMcvAmzULETr5e3a
         e6AQ==
X-Received: by 10.236.120.232 with SMTP id p68mr4947512yhh.43.1372343680878;
        Thu, 27 Jun 2013 07:34:40 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.107.66 with SMTP id ha2ls839807qeb.56.gmail; Thu, 27 Jun
 2013 07:34:40 -0700 (PDT)
X-Received: by 10.49.133.201 with SMTP id pe9mr226098qeb.34.1372343680006;
        Thu, 27 Jun 2013 07:34:40 -0700 (PDT)
In-Reply-To: <291db835-d42d-40cd-8760-47cdf327680d@isocpp.org>
X-Original-Sender: asaelr@gmail.com
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:5257
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/5257>

------=_Part_482_15419926.1372343679497
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

1) *begin* and *end* are the common way to iterate over something. I'm=20
agree that sometimes we just want to have *auto coro(args);coro();
2) You're rig*ht. I had forgotten that class template arguments are not=20
being deducted - even when we just are calling the constructor

If I understood you correctly, you mean to transfrom *int : fib(int n)=20
{/*blablabla/*}* to *fib_class fib(int n) {return fib_class(n);}* , when *
fib_class* is some unnamed data structure. This seems to solve the=20
deduction problem. If we allow *fib_class::operator()*, it means that the=
=20
actual calling is represented by *fib_class*, and not by *fib_class:iterato=
r
*. That's a good idea, but it should deal with:
auto coro=3Dfib(10);
auto iter=3Dfib.begin();
int a=3D*iter; //should be 1
int b=3Dcoro(); //should be 2
++iter; //what does this mean? what is the value of *iter now?
I think that since a coroutine have only one currently return value, an=20
existing iterator should be invalidated when the corouting is being=20
incremented by other way (using another iterator, or *operator()* ).
In this concept, I suggest that an iterator object will contain only=20
reference to the coroutine object, and the position data.
(This also saves the parameters copy in *begin*)

Thanks for the feedback. Clearly I may think more about the concept. (My=20
main goals were to discuss some technical details which weren't clear in=20
https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/PPZJVTDd=
DVQ=20
, and to suggest a new (and - according to my taste - nice) syntax.


=D7=91=D7=AA=D7=90=D7=A8=D7=99=D7=9A =D7=99=D7=95=D7=9D =D7=97=D7=9E=D7=99=
=D7=A9=D7=99, 27 =D7=91=D7=99=D7=95=D7=A0=D7=99 2013 11:53:53 UTC+3, =D7=9E=
=D7=90=D7=AA Xeo:
>
> While I really want to get my hands on native coroutines, I don't think=
=20
> your approach works very well.
>
> 1) Who says we always want to use coroutines as `for(auto r :=20
> coro(args))`? I don't think that's necessarily the main form of use
> 2) How would the transformation to a class work for template argument=20
> deduction?
>
> I think a better course would be to transform the return type of such a=
=20
> function, as would be done with async/await-style functions.
> The returned type would then simply have an `operator()` and if you wante=
d=20
> a range from that, it could be quite easily done with a general=20
> function-adaptor.
>
> On Thursday, June 27, 2013 3:40:58 AM UTC+2, asa...@gmail.com wrote:
>>
>> Recently, I=E2=80=99ve thought a lot about coroutines, and how they shou=
ld behave=20
>> if became a part of c++.
>>
>> I found two (main) proposals:
>>
>> a.=20
>> https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/3g6ZI=
WedGJ8
>>
>> It has the advantage of not requiring to change the syntax, but in force=
=20
>> a new model of stack-based calls. It does so in purpose to let nested=20
>> functions to yield value, which I think is not really necessary. (If we =
let=20
>> nested functions return value on behalf of their callee, we should start=
=20
>> this in regular functions). Also, Its syntax is somehow complex.
>>
>> b.=20
>> https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/PPZJV=
TDdDVQ
>>
>> It is easy to use and doesn=E2=80=99t require a new stack, and I think t=
hat this=20
>> is the right direction. However, it ignores some technical details=20
>> (lifetime of locals, etc). Also, adding a keyword may break too many=20
>> working code, and my personal opinion is that it is ugly. Sentences like=
=20
>> =E2=80=9Cvoid numbers() yields int=E2=80=9D reminds me too many things I=
 hate in Java. The=20
>> alternative syntax (described at the end of this proposal) is not so ugl=
y,=20
>> but still complex.
>>
>> There is even a nice implementation of coroutines (using macros):=20
>> http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
>>
>> but it has 2 major disadvantages: while using it, we can=E2=80=99t yield=
 a value=20
>> from within a switch statement, and, much more important, we have to def=
ine=20
>> all the local variables at the top of the function - back to C90 days! (=
and=20
>> with constructors this is much worst.)
>>
>> Another thing that was very little talk about, is for-range loops native=
=20
>> support. Let=E2=80=99s say we have a Fibonacci number generator (a very =
common=20
>> example):
>>
>> (Using Denis Bredelet=E2=80=99s proposal syntax)
>>
>> void fib(int n) yields int {
>>
>>  int a=3D0,b=3D1;
>>
>>  while(n--) {
>>
>>    int c=3Da+b;
>>
>>    a=3Db;
>>
>>    b=3Dc;
>>
>>    yield c;
>>
>>  }
>>
>> }
>>
>> We want the possibility to write for (int i : fib(10))=20
>> std::cout<<i<<=E2=80=99\n=E2=80=99; to print the first 10 Fibonacci numb=
ers.
>>
>> So what am I suggest?
>>
>> First, to the syntax. Since we want it to work natively with for-range=
=20
>> loops, and since the  language concept is =E2=80=9Cdeclare it the way yo=
u will use=20
>> it=E2=80=9D, I would suggest using colon in the function signature. The =
nicest idea=20
>> I managed to think so far is int : fib(int n)
>>
>> Also, there is no reason to add the keyword yield, when we can stick to=
=20
>> good old return.
>>
>> Now, to the real stuff: What does fib(10) mean? What=E2=80=99s the type =
of=20
>> fib(10).begin()?
>>
>> I suggest this meaning: fib will be (auto-generated) class, and an objec=
t=20
>> of it will represent calling the =E2=80=9Cfunction=E2=80=9D with specifi=
c parameters. The=20
>> member function begin (and end) will return some sort of iterator, which=
=20
>> will represent the actual call.
>>
>> Some details: the fib class should have some members, to contain the=20
>> parameters it called with, but the real fun is in the iterator class: it=
=20
>> will have (in addition to the parameters),  as (not exactly, I will expl=
ain=20
>> below) members, all the local variables of the =E2=80=9Cfunction=E2=80=
=9D (including the=20
>> return value), and also the information about where it stopped last time=
=20
>> (and should resume from) - let=E2=80=99s call it, from now on, =E2=80=9C=
position data=E2=80=9D.
>>
>> To be more precise: an iterator should contain the memory for the local=
=20
>> variables (like every member variable), but their lifetime will be as if=
=20
>> they were local variables of the =E2=80=9Cfunction=E2=80=9D. I mean - th=
ey will been=20
>> constructed only when the =E2=80=9Cfunction=E2=80=9D will decide so, and=
 not automatically=20
>> when the iterator is been constructed.
>>
>> When the =E2=80=9Cfunction=E2=80=9D ends (either by falling through the =
ending brace, not=20
>> catching exception, or simply saying return; without a value), the=20
>> position data should contain this information, and (like every function)=
,=20
>> every local variable should be destructed.
>>
>> Knowing the position data let us easily determine which variables are=20
>> alive, and so I think that the following member functions can be=20
>> automatically created:
>>
>> copy constructor - should copy the position data, the parameters, and=20
>> every living local variable
>>
>> move constructor - the same, but move instead of copy
>>
>> destructor - destroy the parameters, and every living local variable.
>>
>> (Of course, if some local variable is noncopyable, so is the iterator)
>>
>> I think that it should not be assignable - If one iterator have a live=
=20
>> object, and another one have not, it=E2=80=99s a real mess.
>>
>> Some example:
>>
>> Suppose that we want to yield the number 0, and then, the first n=20
>> Fibonacci numbers and the first n even number, alternately. To add more=
=20
>> interest (and to demonstrate more rules), I want to create and destroy s=
ome=20
>> objects (assume A is a copyable, moveable, and int-constructive class),=
=20
>> so I=E2=80=99ve written the following code:
>>
>> int : fib_even(int n) {
>>
>>    A a(7);
>>
>>    int fib1=3D0,fib2=3D1,even=3D0;
>>
>>    return 0;
>>
>>    while(n--) {
>>
>>        int fib3=3Dfib1+fib2;
>>
>>        fib1=3Dfib2;
>>
>>        fib2=3Dfib3;
>>
>>        return fib3;
>>
>>        A b=3Dn;
>>
>>        return even+=3D2;
>>
>>    }
>>
>> }
>>
>> A compiler may expand it to something like:
>>
>> (Note: I=E2=80=99m using dynamic memory allocation, but It=E2=80=99s not=
 really how it=20
>> should be implemented - I just don=E2=80=99t want some constructors and =
destructors=20
>> to been invoked automatically)
>>
>> class fib_even {
>>
>>    class iterator {
>>
>>        int n;
>>
>>        int *fib1,*fib2,*fib3,*even;
>>
>>        A *a,*b;
>>
>>        int *ret_value;
>>
>>        enum {p0,p1,p2,p3,p4} pos; //resuming points
>>
>>        void next() {
>>
>>            switch (pos) {
>>
>>                case p0: break;
>>
>>                case p1: goto label1;
>>
>>                case p2: goto label2;
>>
>>                case p3: goto label3;
>>
>>                case p4: return;
>>
>>            }
>>
>> //construct automatic variables of the function
>>
>>            a=3Dnew A(7);
>>
>>            fib1=3Dnew int(0);
>>
>>            fib2=3Dnew int(1);
>>
>>            even=3Dnew int(0);
>>
>> //the return process - create the value, save the resuming point, and=20
>> return
>>
>>            ret_value=3Dnew int(0);
>>
>>            pos=3Dp1;
>>
>>            return;
>>
>>        label1:
>>
>>            while(n--) {
>>
>>                fib3=3Dnew int(*fib1+*fib2); //being constructed only now
>>
>>                *fib1=3D*fib2;
>>
>>                *fib2=3D*fib3;
>>
>>                ret_value=3Dnew int(*fib3);
>>
>>                pos=3Dp2;
>>
>>                return;
>>
>>        label2:
>>
>>                b=3Dnew A(n);
>>
>>                ret_value=3Dnew int((*even)+=3D2);
>>
>>                pos=3Dp3;
>>
>>                return;
>>
>>        label3:
>>
>> //automatic variables going out of scope, and should be destructed
>>
>>                delete b;
>>
>>                delete fib3;
>>
>>            }
>>
>>            delete even;
>>
>>            delete fib2;
>>
>>            delete fib1;
>>
>>            delete a;
>>
>>            pos=3Dp4;
>>
>>        }
>>
>>        iterator(int n) : n(n),pos(p0) {
>>
>>            next(); //get the first value
>>
>>        }
>>
>>        iterator() : pos(p4) {}
>>
>>    public:
>>
>>        iterator &operator++() {
>>
>>            delete ret_value;
>>
>>            next();
>>
>>            return *this;
>>
>>        }
>>
>>        int &operator*() {
>>
>>            return *ret_value;
>>
>>        }
>>
>>        iterator(const iterator &it) : n(it.n),pos(it.pos) {
>>
>> //copy only living members
>>
>>            if (pos>p0 && pos<p4) {
>>
>>                ret_value=3Dnew int(*it.ret_value);
>>
>>                a=3Dnew A(*it.a);
>>
>>                fib1=3Dnew int(*it.fib1);
>>
>>                fib2=3Dnew int(*it.fib2);
>>
>>                even=3Dnew int(*it.even);
>>
>>            }
>>
>>            if (pos>p1 && pos<p4) fib3=3Dnew int(*it.fib3);
>>
>>            if (pos>p2 && pos<p4) b=3Dnew A(*it.b);
>>
>>        }
>>
>>        iterator(iterator &&it) : n(std::move(it.n)),pos(it.pos) {
>>
>>            if (pos>p0 && pos<p4) {
>>
>>                ret_value=3Dnew int(std::move(*it.ret_value));
>>
>>                a=3Dnew A(std::move(*it.a));
>>
>>                fib1=3Dnew int(std::move(*it.fib1));
>>
>>                fib2=3Dnew int(std::move(*it.fib2));
>>
>>                even=3Dnew int(std::move(*it.even));
>>
>>            }
>>
>>            if (pos>p1 && pos<p4) fib3=3Dnew int(std::move(*it.fib3));
>>
>>            if (pos>p2 && pos<p4) b=3Dnew A(std::move(*it.b));
>>
>>        }
>>
>>        ~iterator() {
>>
>>            if (pos>p2 && pos<p4) delete b;
>>
>>            if (pos>p1 && pos<p4) delete fib3;
>>
>>            if (pos>p0 && pos<p4) {
>>
>>                delete even;
>>
>>                delete fib2;
>>
>>                delete fib1;
>>
>>                delete a;
>>
>>                delete ret_value;
>>
>>            }
>>
>>        }
>>
>>        bool operator!=3D(const iterator &it) {
>>
>>            return pos!=3Dit.pos;
>>
>>        }
>>
>>        operator bool() {
>>
>>            return pos<p4; //still hasn't ended
>>
>>        }
>>
>>        iterator &operator=3D(const iterator&) =3D delete;
>>
>>        friend fib_even;
>>
>>    };
>>
>>    int n;
>>
>> public:
>>
>>    fib_even(int n) : n(n) {}
>>
>>    iterator begin() {
>>
>>        return iterator(n);
>>
>>    }
>>
>>    iterator end() {
>>
>>        return iterator();
>>
>>    }
>>
>> };
>>
>> So, what do you think?
>>
>

--=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_482_15419926.1372343679497
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

1) <i>begin</i> and <i>end</i> are the common way to iterate over something=
.. I'm agree that sometimes we just want to have <i>auto coro(args);coro();<=
br>2) You're rig</i>ht. I had forgotten that class template arguments are n=
ot being deducted - even when we just are calling the constructor<br><br>If=
 I understood you correctly, you mean to transfrom <i>int : fib(int n) {/*b=
lablabla/*}</i> to <i>fib_class fib(int n) {return fib_class(n);}</i> , whe=
n <i>fib_class</i> is some unnamed data structure. This seems to solve the =
deduction problem. If we allow <i>fib_class::operator()</i>, it means that =
the actual calling is represented by <i>fib_class</i>, and not by <i>fib_cl=
ass:iterator</i>. That's a good idea, but it should deal with:<br>auto coro=
=3Dfib(10);<br>auto iter=3Dfib.begin();<br>int a=3D*iter; //should be 1<br>=
int b=3Dcoro(); //should be 2<br>++iter; //what does this mean? what is the=
 value of *iter now?<br>I think that since a coroutine have only one curren=
tly return value, an existing iterator should be invalidated when the corou=
ting is being incremented by other way (using another iterator, or <i>opera=
tor()</i> ).<br>In this concept, I suggest that an iterator object will con=
tain only reference to the coroutine object, and the position data.<br>(Thi=
s also saves the parameters copy in <i>begin</i>)<br><br>Thanks for the fee=
dback. Clearly I may think more about the concept. (My main goals were to d=
iscuss some technical details which weren't clear in https://groups.google.=
com/a/isocpp.org/forum/#!topic/std-proposals/PPZJVTDdDVQ , and to suggest a=
 new (and - according to my taste - nice) syntax.<br><br><br>=D7=91=D7=AA=
=D7=90=D7=A8=D7=99=D7=9A =D7=99=D7=95=D7=9D =D7=97=D7=9E=D7=99=D7=A9=D7=99,=
 27 =D7=91=D7=99=D7=95=D7=A0=D7=99 2013 11:53:53 UTC+3, =D7=9E=D7=90=D7=AA =
Xeo:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex=
;border-left: 1px #ccc solid;padding-left: 1ex;">While I really want to get=
 my hands on native coroutines, I don't think your approach works very well=
..<br><br>1) Who says we always want to use coroutines as `for(auto r : coro=
(args))`? I don't think that's necessarily the main form of use<br>2) How w=
ould the transformation to a class work for template argument deduction?<br=
><br>I think a better course would be to transform the return type of such =
a function, as would be done with async/await-style functions.<br>The retur=
ned type would then simply have an `operator()` and if you wanted a range f=
rom that, it could be quite easily done with a general function-adaptor.<br=
><br>On Thursday, June 27, 2013 3:40:58 AM UTC+2, <a>asa...@gmail.com</a> w=
rote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;=
border-left:1px #ccc solid;padding-left:1ex"><p dir=3D"ltr" style=3D"line-h=
eight:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;=
font-family:Arial;color:#000000;background-color:transparent;font-weight:no=
rmal;font-style:normal;font-variant:normal;text-decoration:none;vertical-al=
ign:baseline">Recently, I=E2=80=99ve thought a lot about coroutines, and ho=
w they should behave if became a part of c++.</span></p><p dir=3D"ltr" styl=
e=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font=
-size:15px;font-family:Arial;color:#000000;background-color:transparent;fon=
t-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;=
vertical-align:baseline">I found two (main) proposals:</span></p><p dir=3D"=
ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span styl=
e=3D"font-size:15px;font-family:Arial;color:#000000;background-color:transp=
arent;font-weight:normal;font-style:normal;font-variant:normal;text-decorat=
ion:none;vertical-align:baseline">a. </span><a href=3D"https://groups.googl=
e.com/a/isocpp.org/forum/#%21topic/std-proposals/3g6ZIWedGJ8" style=3D"text=
-decoration:none" target=3D"_blank"><span style=3D"font-size:15px;font-fami=
ly:Arial;color:#1155cc;background-color:transparent;font-weight:normal;font=
-style:normal;font-variant:normal;text-decoration:underline;vertical-align:=
baseline">https://groups.google.com/a/<wbr>isocpp.org/forum/#!topic/std-<wb=
r>proposals/3g6ZIWedGJ8</span></a><span style=3D"font-size:15px;font-family=
:Arial;color:#000000;background-color:transparent;font-weight:normal;font-s=
tyle:normal;font-variant:normal;text-decoration:none;vertical-align:baselin=
e"></span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margi=
n-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000=
;background-color:transparent;font-weight:normal;font-style:normal;font-var=
iant:normal;text-decoration:none;vertical-align:baseline">It
 has the advantage of not requiring to change the syntax, but in force a
 new model of stack-based calls. It does so in purpose to let nested=20
functions to yield value, which I think is not really necessary. (If we=20
let nested functions return value on behalf of their callee, we should=20
start this in regular functions). Also, Its syntax is somehow complex.</spa=
n></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom=
:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgro=
und-color:transparent;font-weight:normal;font-style:normal;font-variant:nor=
mal;text-decoration:none;vertical-align:baseline">b. </span><a href=3D"http=
s://groups.google.com/a/isocpp.org/forum/#%21topic/std-proposals/PPZJVTDdDV=
Q" style=3D"text-decoration:none" target=3D"_blank"><span style=3D"font-siz=
e:15px;font-family:Arial;color:#1155cc;background-color:transparent;font-we=
ight:normal;font-style:normal;font-variant:normal;text-decoration:underline=
;vertical-align:baseline">https://groups.google.com/a/<wbr>isocpp.org/forum=
/#!topic/std-<wbr>proposals/PPZJVTDdDVQ</span></a><span style=3D"font-size:=
15px;font-family:Arial;color:#000000;background-color:transparent;font-weig=
ht:normal;font-style:normal;font-variant:normal;text-decoration:none;vertic=
al-align:baseline"></span></p><p dir=3D"ltr" style=3D"line-height:1.15;marg=
in-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Ari=
al;color:#000000;background-color:transparent;font-weight:normal;font-style=
:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">I=
t
 is easy to use and doesn=E2=80=99t require a new stack, and I think that t=
his=20
is the right direction. However, it ignores some technical details=20
(lifetime of locals, etc). Also, adding a keyword may break too many=20
working code, and my personal opinion is that it is ugly. Sentences like
 =E2=80=9Cvoid numbers() yields int=E2=80=9D reminds me too many things I h=
ate in Java.=20
The alternative syntax (described at the end of this proposal) is not so
 ugly, but still complex.</span></p><p dir=3D"ltr" style=3D"line-height:1.1=
5;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-fami=
ly:Arial;color:#000000;background-color:transparent;font-weight:normal;font=
-style:normal;font-variant:normal;text-decoration:none;vertical-align:basel=
ine">There is even a nice implementation of coroutines (using macros): </sp=
an><a href=3D"http://www.chiark.greenend.org.uk/%7Esgtatham/coroutines.html=
" style=3D"text-decoration:none" target=3D"_blank"><span style=3D"font-size=
:15px;font-family:Arial;color:#1155cc;background-color:transparent;font-wei=
ght:normal;font-style:normal;font-variant:normal;text-decoration:underline;=
vertical-align:baseline">http://www.chiark.greenend.<wbr>org.uk/~sgtatham/c=
oroutines.<wbr>html</span></a><span style=3D"font-size:15px;font-family:Ari=
al;color:#000000;background-color:transparent;font-weight:normal;font-style=
:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"><=
/span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bo=
ttom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;bac=
kground-color:transparent;font-weight:normal;font-style:normal;font-variant=
:normal;text-decoration:none;vertical-align:baseline">but
 it has 2 major disadvantages: while using it, we can=E2=80=99t yield a val=
ue=20
from within a switch statement, and, much more important, we have to=20
define all the local variables at the top of the function - back to C90=20
days! (and with constructors this is much worst.)</span></p><br><span style=
=3D"font-size:15px;font-family:Arial;color:#000000;background-color:transpa=
rent;font-weight:normal;font-style:normal;font-variant:normal;text-decorati=
on:none;vertical-align:baseline"></span><p dir=3D"ltr" style=3D"line-height=
:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-=
family:Arial;color:#000000;background-color:transparent;font-weight:normal;=
font-style:normal;font-variant:normal;text-decoration:none;vertical-align:b=
aseline">Another
 thing that was very little talk about, is for-range loops native=20
support. Let=E2=80=99s say we have a Fibonacci number generator (a very com=
mon=20
example):</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt=
;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#=
000000;background-color:transparent;font-weight:normal;font-style:normal;fo=
nt-variant:normal;text-decoration:none;vertical-align:baseline">(Using Deni=
s Bredelet=E2=80=99s proposal syntax)</span></p><p dir=3D"ltr" style=3D"lin=
e-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15=
px;font-family:Arial;color:#000000;background-color:transparent;font-weight=
:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical=
-align:baseline">void fib(int n) yields int {</span></p><p dir=3D"ltr" styl=
e=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font=
-size:15px;font-family:Arial;color:#000000;background-color:transparent;fon=
t-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;=
vertical-align:baseline"> &nbsp;int a=3D0,b=3D1;</span></p><p dir=3D"ltr" s=
tyle=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"f=
ont-size:15px;font-family:Arial;color:#000000;background-color:transparent;=
font-weight:normal;font-style:normal;font-variant:normal;text-decoration:no=
ne;vertical-align:baseline"> &nbsp;while(n--) {</span></p><p dir=3D"ltr" st=
yle=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"fo=
nt-size:15px;font-family:Arial;color:#000000;background-color:transparent;f=
ont-weight:normal;font-style:normal;font-variant:normal;text-decoration:non=
e;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;int c=3Da+b;</span></p><p dir=
=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span =
style=3D"font-size:15px;font-family:Arial;color:#000000;background-color:tr=
ansparent;font-weight:normal;font-style:normal;font-variant:normal;text-dec=
oration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;a=3Db;</span></p><=
p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><=
span style=3D"font-size:15px;font-family:Arial;color:#000000;background-col=
or:transparent;font-weight:normal;font-style:normal;font-variant:normal;tex=
t-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;b=3Dc;</span>=
</p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0=
pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgroun=
d-color:transparent;font-weight:normal;font-style:normal;font-variant:norma=
l;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;yield c;=
</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-b=
ottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;ba=
ckground-color:transparent;font-weight:normal;font-style:normal;font-varian=
t:normal;text-decoration:none;vertical-align:baseline"> &nbsp;}</span></p><=
p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><=
span style=3D"font-size:15px;font-family:Arial;color:#000000;background-col=
or:transparent;font-weight:normal;font-style:normal;font-variant:normal;tex=
t-decoration:none;vertical-align:baseline">}</span></p><p dir=3D"ltr" style=
=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-=
size:15px;font-family:Arial;color:#000000;background-color:transparent;font=
-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;v=
ertical-align:baseline">We want the possibility to write </span><span style=
=3D"font-size:15px;font-family:Arial;color:#000000;background-color:transpa=
rent;font-weight:normal;font-style:italic;font-variant:normal;text-decorati=
on:none;vertical-align:baseline">for (int i : fib(10)) std::cout&lt;&lt;i&l=
t;&lt;=E2=80=99\n=E2=80=99;</span><span style=3D"font-size:15px;font-family=
:Arial;color:#000000;background-color:transparent;font-weight:normal;font-s=
tyle:normal;font-variant:normal;text-decoration:none;vertical-align:baselin=
e"> to print the first 10 Fibonacci numbers.</span></p><br><span style=3D"f=
ont-size:15px;font-family:Arial;color:#000000;background-color:transparent;=
font-weight:normal;font-style:normal;font-variant:normal;text-decoration:no=
ne;vertical-align:baseline"></span><p dir=3D"ltr" style=3D"line-height:1.15=
;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-famil=
y:Arial;color:#000000;background-color:transparent;font-weight:normal;font-=
style:normal;font-variant:normal;text-decoration:none;vertical-align:baseli=
ne">So what am I suggest?</span></p><p dir=3D"ltr" style=3D"line-height:1.1=
5;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-fami=
ly:Arial;color:#000000;background-color:transparent;font-weight:normal;font=
-style:normal;font-variant:normal;text-decoration:none;vertical-align:basel=
ine">First,
 to the syntax. Since we want it to work natively with for-range loops,=20
and since the &nbsp;language concept is =E2=80=9Cdeclare it the way you wil=
l use it=E2=80=9D,
 I would suggest using colon in the function signature. The nicest idea I
 managed to think so far is </span><span style=3D"font-size:15px;font-famil=
y:Arial;color:#000000;background-color:transparent;font-weight:normal;font-=
style:italic;font-variant:normal;text-decoration:none;vertical-align:baseli=
ne">int : fib(int n)</span></p><p dir=3D"ltr" style=3D"line-height:1.15;mar=
gin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Ar=
ial;color:#000000;background-color:transparent;font-weight:normal;font-styl=
e:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">=
Also, there is no reason to add the keyword </span><span style=3D"font-size=
:15px;font-family:Arial;color:#000000;background-color:transparent;font-wei=
ght:normal;font-style:italic;font-variant:normal;text-decoration:none;verti=
cal-align:baseline">yield</span><span style=3D"font-size:15px;font-family:A=
rial;color:#000000;background-color:transparent;font-weight:normal;font-sty=
le:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"=
>, when we can stick to good old </span><span style=3D"font-size:15px;font-=
family:Arial;color:#000000;background-color:transparent;font-weight:normal;=
font-style:italic;font-variant:normal;text-decoration:none;vertical-align:b=
aseline">return</span><span style=3D"font-size:15px;font-family:Arial;color=
:#000000;background-color:transparent;font-weight:normal;font-style:normal;=
font-variant:normal;text-decoration:none;vertical-align:baseline">.</span><=
/p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0p=
t"><span style=3D"font-size:15px;font-family:Arial;color:#000000;background=
-color:transparent;font-weight:normal;font-style:normal;font-variant:normal=
;text-decoration:none;vertical-align:baseline">Now, to the real stuff: What=
 does </span><span style=3D"font-size:15px;font-family:Arial;color:#000000;=
background-color:transparent;font-weight:normal;font-style:italic;font-vari=
ant:normal;text-decoration:none;vertical-align:baseline">fib(10)</span><spa=
n style=3D"font-size:15px;font-family:Arial;color:#000000;background-color:=
transparent;font-weight:normal;font-style:normal;font-variant:normal;text-d=
ecoration:none;vertical-align:baseline"> mean? What=E2=80=99s the type of <=
/span><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgro=
und-color:transparent;font-weight:normal;font-style:italic;font-variant:nor=
mal;text-decoration:none;vertical-align:baseline">fib(10).begin()</span><sp=
an style=3D"font-size:15px;font-family:Arial;color:#000000;background-color=
:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-=
decoration:none;vertical-align:baseline">?</span></p><p dir=3D"ltr" style=
=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-=
size:15px;font-family:Arial;color:#000000;background-color:transparent;font=
-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;v=
ertical-align:baseline">I
 suggest this meaning: fib will be (auto-generated) class, and an object
 of it will represent calling the =E2=80=9Cfunction=E2=80=9D with specific =
parameters.=20
The member function </span><span style=3D"font-size:15px;font-family:Arial;=
color:#000000;background-color:transparent;font-weight:normal;font-style:it=
alic;font-variant:normal;text-decoration:none;vertical-align:baseline">begi=
n</span><span style=3D"font-size:15px;font-family:Arial;color:#000000;backg=
round-color:transparent;font-weight:normal;font-style:normal;font-variant:n=
ormal;text-decoration:none;vertical-align:baseline"> (and </span><span styl=
e=3D"font-size:15px;font-family:Arial;color:#000000;background-color:transp=
arent;font-weight:normal;font-style:italic;font-variant:normal;text-decorat=
ion:none;vertical-align:baseline">end</span><span style=3D"font-size:15px;f=
ont-family:Arial;color:#000000;background-color:transparent;font-weight:nor=
mal;font-style:normal;font-variant:normal;text-decoration:none;vertical-ali=
gn:baseline">) will return some sort of iterator, which will represent the =
actual call.</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:=
0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;colo=
r:#000000;background-color:transparent;font-weight:normal;font-style:normal=
;font-variant:normal;text-decoration:none;vertical-align:baseline">Some det=
ails: the </span><span style=3D"font-size:15px;font-family:Arial;color:#000=
000;background-color:transparent;font-weight:normal;font-style:italic;font-=
variant:normal;text-decoration:none;vertical-align:baseline">fib</span><spa=
n style=3D"font-size:15px;font-family:Arial;color:#000000;background-color:=
transparent;font-weight:normal;font-style:normal;font-variant:normal;text-d=
ecoration:none;vertical-align:baseline"> class should have some members, to=
 contain the parameters it called with, but the real fun is in the </span><=
span style=3D"font-size:15px;font-family:Arial;color:#000000;background-col=
or:transparent;font-weight:normal;font-style:italic;font-variant:normal;tex=
t-decoration:none;vertical-align:baseline">iterator</span><span style=3D"fo=
nt-size:15px;font-family:Arial;color:#000000;background-color:transparent;f=
ont-weight:normal;font-style:normal;font-variant:normal;text-decoration:non=
e;vertical-align:baseline">
 class: it will have (in addition to the parameters), &nbsp;as (not exactly=
, I
 will explain below) members, all the local variables of the =E2=80=9Cfunct=
ion=E2=80=9D=20
(including the return value), and also the information about where it=20
stopped last time (and should resume from) - let=E2=80=99s call it, from no=
w on,
 =E2=80=9Cposition data=E2=80=9D.</span></p><p dir=3D"ltr" style=3D"line-he=
ight:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;f=
ont-family:Arial;color:#000000;background-color:transparent;font-weight:nor=
mal;font-style:normal;font-variant:normal;text-decoration:none;vertical-ali=
gn:baseline">To be more precise: an </span><span style=3D"font-size:15px;fo=
nt-family:Arial;color:#000000;background-color:transparent;font-weight:norm=
al;font-style:italic;font-variant:normal;text-decoration:none;vertical-alig=
n:baseline">iterator</span><span style=3D"font-size:15px;font-family:Arial;=
color:#000000;background-color:transparent;font-weight:normal;font-style:no=
rmal;font-variant:normal;text-decoration:none;vertical-align:baseline">
 should contain the memory for the local variables (like every member=20
variable), but their lifetime will be as if they were local variables of
 the =E2=80=9Cfunction=E2=80=9D. I mean - they will been constructed only w=
hen the=20
=E2=80=9Cfunction=E2=80=9D will decide so, and not automatically when the <=
/span><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgro=
und-color:transparent;font-weight:normal;font-style:italic;font-variant:nor=
mal;text-decoration:none;vertical-align:baseline">iterator</span><span styl=
e=3D"font-size:15px;font-family:Arial;color:#000000;background-color:transp=
arent;font-weight:normal;font-style:normal;font-variant:normal;text-decorat=
ion:none;vertical-align:baseline"> is been constructed.</span></p><p dir=3D=
"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span sty=
le=3D"font-size:15px;font-family:Arial;color:#000000;background-color:trans=
parent;font-weight:normal;font-style:normal;font-variant:normal;text-decora=
tion:none;vertical-align:baseline">When the =E2=80=9Cfunction=E2=80=9D ends=
 (either by falling through the ending brace, not catching exception, or si=
mply saying </span><span style=3D"font-size:15px;font-family:Arial;color:#0=
00000;background-color:transparent;font-weight:normal;font-style:italic;fon=
t-variant:normal;text-decoration:none;vertical-align:baseline">return;</spa=
n><span style=3D"font-size:15px;font-family:Arial;color:#000000;background-=
color:transparent;font-weight:normal;font-style:normal;font-variant:normal;=
text-decoration:none;vertical-align:baseline">
 without a value), the position data should contain this information,=20
and (like every function), every local variable should be destructed.</span=
></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:=
0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgrou=
nd-color:transparent;font-weight:normal;font-style:normal;font-variant:norm=
al;text-decoration:none;vertical-align:baseline">Knowing
 the position data let us easily determine which variables are alive,=20
and so I think that the following member functions can be automatically=20
created:</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;=
margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#0=
00000;background-color:transparent;font-weight:normal;font-style:normal;fon=
t-variant:normal;text-decoration:none;vertical-align:baseline">copy constru=
ctor - should copy the position data, the parameters, and every living loca=
l variable</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0p=
t;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:=
#000000;background-color:transparent;font-weight:normal;font-style:normal;f=
ont-variant:normal;text-decoration:none;vertical-align:baseline">move const=
ructor - the same, but move instead of copy</span></p><p dir=3D"ltr" style=
=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-=
size:15px;font-family:Arial;color:#000000;background-color:transparent;font=
-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;v=
ertical-align:baseline">destructor - destroy the parameters, and every livi=
ng local variable.</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margi=
n-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Aria=
l;color:#000000;background-color:transparent;font-weight:normal;font-style:=
normal;font-variant:normal;text-decoration:none;vertical-align:baseline">(O=
f course, if some local variable is noncopyable, so is the iterator)</span>=
</p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0=
pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgroun=
d-color:transparent;font-weight:normal;font-style:normal;font-variant:norma=
l;text-decoration:none;vertical-align:baseline">I think that it should not =
be assignable - If one iterator have a live object, and another one have no=
t, it=E2=80=99s a real mess.</span></p><br><span style=3D"font-size:15px;fo=
nt-family:Arial;color:#000000;background-color:transparent;font-weight:norm=
al;font-style:normal;font-variant:normal;text-decoration:none;vertical-alig=
n:baseline"></span><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;=
margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#0=
00000;background-color:transparent;font-weight:normal;font-style:normal;fon=
t-variant:normal;text-decoration:none;vertical-align:baseline">Some example=
:</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-=
bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;b=
ackground-color:transparent;font-weight:normal;font-style:normal;font-varia=
nt:normal;text-decoration:none;vertical-align:baseline">Suppose
 that we want to yield the number 0, and then, the first n Fibonacci=20
numbers and the first n even number, alternately. To add more interest=20
(and to demonstrate more rules), I want to create and destroy some=20
objects (assume </span><span style=3D"font-size:15px;font-family:Arial;colo=
r:#000000;background-color:transparent;font-weight:normal;font-style:italic=
;font-variant:normal;text-decoration:none;vertical-align:baseline">A</span>=
<span style=3D"font-size:15px;font-family:Arial;color:#000000;background-co=
lor:transparent;font-weight:normal;font-style:normal;font-variant:normal;te=
xt-decoration:none;vertical-align:baseline"> is a copyable, moveable, and i=
nt-constructive class), so I=E2=80=99ve written the following code:</span><=
/p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0p=
t"><span style=3D"font-size:15px;font-family:Arial;color:#000000;background=
-color:transparent;font-weight:normal;font-style:normal;font-variant:normal=
;text-decoration:none;vertical-align:baseline">int : fib_even(int n) {</spa=
n></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom=
:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgro=
und-color:transparent;font-weight:normal;font-style:normal;font-variant:nor=
mal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;A a(7)=
;</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-=
bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;b=
ackground-color:transparent;font-weight:normal;font-style:normal;font-varia=
nt:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;=
int fib1=3D0,fib2=3D1,even=3D0;</span></p><p dir=3D"ltr" style=3D"line-heig=
ht:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;fon=
t-family:Arial;color:#000000;background-color:transparent;font-weight:norma=
l;font-style:normal;font-variant:normal;text-decoration:none;vertical-align=
:baseline"> &nbsp;&nbsp;&nbsp;return 0;</span></p><p dir=3D"ltr" style=3D"l=
ine-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:=
15px;font-family:Arial;color:#000000;background-color:transparent;font-weig=
ht:normal;font-style:normal;font-variant:normal;text-decoration:none;vertic=
al-align:baseline"> &nbsp;&nbsp;&nbsp;while(n--) {</span></p><p dir=3D"ltr"=
 style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D=
"font-size:15px;font-family:Arial;color:#000000;background-color:transparen=
t;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:=
none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;int fib=
3=3Dfib1+fib2;</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-to=
p:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;co=
lor:#000000;background-color:transparent;font-weight:normal;font-style:norm=
al;font-variant:normal;text-decoration:none;vertical-align:baseline"> &nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;fib1=3Dfib2;</span></p><p dir=3D"ltr" style=
=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-=
size:15px;font-family:Arial;color:#000000;background-color:transparent;font=
-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;v=
ertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;fib2=3Dfib3;<=
/span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bo=
ttom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;bac=
kground-color:transparent;font-weight:normal;font-style:normal;font-variant=
:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; &nbsp;return fib3;</span></p><p dir=3D"ltr" style=3D"line-height=
:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-=
family:Arial;color:#000000;background-color:transparent;font-weight:normal;=
font-style:normal;font-variant:normal;text-decoration:none;vertical-align:b=
aseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;A b=3Dn;</span></p><p dir=3D=
"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span sty=
le=3D"font-size:15px;font-family:Arial;color:#000000;background-color:trans=
parent;font-weight:normal;font-style:normal;font-variant:normal;text-decora=
tion:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;re=
turn even+=3D2;</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-t=
op:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;c=
olor:#000000;background-color:transparent;font-weight:normal;font-style:nor=
mal;font-variant:normal;text-decoration:none;vertical-align:baseline"> &nbs=
p;&nbsp;&nbsp;}</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-t=
op:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;c=
olor:#000000;background-color:transparent;font-weight:normal;font-style:nor=
mal;font-variant:normal;text-decoration:none;vertical-align:baseline">}</sp=
an></p><br><span style=3D"font-size:15px;font-family:Arial;color:#000000;ba=
ckground-color:transparent;font-weight:normal;font-style:normal;font-varian=
t:normal;text-decoration:none;vertical-align:baseline"></span><p dir=3D"ltr=
" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=
=3D"font-size:15px;font-family:Arial;color:#000000;background-color:transpa=
rent;font-weight:normal;font-style:normal;font-variant:normal;text-decorati=
on:none;vertical-align:baseline">A compiler may expand it to something like=
:</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-=
bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;b=
ackground-color:transparent;font-weight:normal;font-style:normal;font-varia=
nt:normal;text-decoration:none;vertical-align:baseline">(Note:
 I=E2=80=99m using dynamic memory allocation, but It=E2=80=99s not really h=
ow it should=20
be implemented - I just don=E2=80=99t want some constructors and destructor=
s to=20
been invoked automatically)</span></p><br><span style=3D"font-size:15px;fon=
t-family:Arial;color:#000000;background-color:transparent;font-weight:norma=
l;font-style:normal;font-variant:normal;text-decoration:none;vertical-align=
:baseline"></span><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;m=
argin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#00=
0000;background-color:transparent;font-weight:normal;font-style:normal;font=
-variant:normal;text-decoration:none;vertical-align:baseline">class fib_eve=
n {</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margi=
n-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000=
;background-color:transparent;font-weight:normal;font-style:normal;font-var=
iant:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbs=
p;class iterator {</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margi=
n-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Aria=
l;color:#000000;background-color:transparent;font-weight:normal;font-style:=
normal;font-variant:normal;text-decoration:none;vertical-align:baseline"> &=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;int n;</span></p><p dir=3D"ltr" style=
=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-=
size:15px;font-family:Arial;color:#000000;background-color:transparent;font=
-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;v=
ertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;int *fib1,*fi=
b2,*fib3,*even;</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-t=
op:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;c=
olor:#000000;background-color:transparent;font-weight:normal;font-style:nor=
mal;font-variant:normal;text-decoration:none;vertical-align:baseline"> &nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;A *a,*b;</span></p><p dir=3D"ltr" style=3D=
"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-siz=
e:15px;font-family:Arial;color:#000000;background-color:transparent;font-we=
ight:normal;font-style:normal;font-variant:normal;text-decoration:none;vert=
ical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;int *ret_value;<=
/span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bo=
ttom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;bac=
kground-color:transparent;font-weight:normal;font-style:normal;font-variant=
:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; &nbsp;enum {p0,p1,p2,p3,p4} pos; //resuming points<br></span></p=
><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"=
><span style=3D"font-size:15px;font-family:Arial;color:#000000;background-c=
olor:transparent;font-weight:normal;font-style:normal;font-variant:normal;t=
ext-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; &nbsp;void next() {</span></p><p dir=3D"ltr" style=3D"line-height:1.15;ma=
rgin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:A=
rial;color:#000000;background-color:transparent;font-weight:normal;font-sty=
le:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"=
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;switch (pos) {</s=
pan></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bott=
om:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backg=
round-color:transparent;font-weight:normal;font-style:normal;font-variant:n=
ormal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case p0: break;</span>=
</p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0=
pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgroun=
d-color:transparent;font-weight:normal;font-style:normal;font-variant:norma=
l;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case p1: goto label1;</spa=
n></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom=
:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgro=
und-color:transparent;font-weight:normal;font-style:normal;font-variant:nor=
mal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case p2: goto label2;</s=
pan></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bott=
om:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backg=
round-color:transparent;font-weight:normal;font-style:normal;font-variant:n=
ormal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case p3: goto label3;<=
/span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bo=
ttom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;bac=
kground-color:transparent;font-weight:normal;font-style:normal;font-variant=
:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;case p4: return;</sp=
an></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-botto=
m:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgr=
ound-color:transparent;font-weight:normal;font-style:normal;font-variant:no=
rmal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}</span></p><p dir=3D"ltr" style=3D"line-h=
eight:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;=
font-family:Arial;color:#000000;background-color:transparent;font-weight:no=
rmal;font-style:normal;font-variant:normal;text-decoration:none;vertical-al=
ign:baseline">//construct automatic variables of t</span><span style=3D"fon=
t-size:15px;font-family:Arial;color:#000000;background-color:transparent;fo=
nt-weight:normal;font-style:normal;font-variant:normal;text-decoration:none=
;vertical-align:baseline">he function<br></span></p><p dir=3D"ltr" style=3D=
"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-siz=
e:15px;font-family:Arial;color:#000000;background-color:transparent;font-we=
ight:normal;font-style:normal;font-variant:normal;text-decoration:none;vert=
ical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nb=
sp;a=3Dnew A(7);</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-=
top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;=
color:#000000;background-color:transparent;font-weight:normal;font-style:no=
rmal;font-variant:normal;text-decoration:none;vertical-align:baseline"> &nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;fib1=3Dnew int(0);</sp=
an></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-botto=
m:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgr=
ound-color:transparent;font-weight:normal;font-style:normal;font-variant:no=
rmal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;fib2=3Dnew int(1);</span></p><p dir=3D"ltr=
" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=
=3D"font-size:15px;font-family:Arial;color:#000000;background-color:transpa=
rent;font-weight:normal;font-style:normal;font-variant:normal;text-decorati=
on:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbs=
p;&nbsp; &nbsp;even=3Dnew int(0);</span></p><p dir=3D"ltr" style=3D"line-he=
ight:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;f=
ont-family:Arial;color:#000000;background-color:transparent;font-weight:nor=
mal;font-style:normal;font-variant:normal;text-decoration:none;vertical-ali=
gn:baseline">//t</span><span style=3D"font-size:15px;font-family:Arial;colo=
r:#000000;background-color:transparent;font-weight:normal;font-style:normal=
;font-variant:normal;text-decoration:none;vertical-align:baseline">he retur=
n process - create t</span><span style=3D"font-size:15px;font-family:Arial;=
color:#000000;background-color:transparent;font-weight:normal;font-style:no=
rmal;font-variant:normal;text-decoration:none;vertical-align:baseline">he v=
alue, save t</span><span style=3D"font-size:15px;font-family:Arial;color:#0=
00000;background-color:transparent;font-weight:normal;font-style:normal;fon=
t-variant:normal;text-decoration:none;vertical-align:baseline">he resuming =
point, and return<br></span></p><p dir=3D"ltr" style=3D"line-height:1.15;ma=
rgin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:A=
rial;color:#000000;background-color:transparent;font-weight:normal;font-sty=
le:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"=
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;ret_value=3Dnew i=
nt(0);</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;ma=
rgin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000=
000;background-color:transparent;font-weight:normal;font-style:normal;font-=
variant:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;pos=3Dp1;</span></p><p dir=3D"lt=
r" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=
=3D"font-size:15px;font-family:Arial;color:#000000;background-color:transpa=
rent;font-weight:normal;font-style:normal;font-variant:normal;text-decorati=
on:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbs=
p;&nbsp; &nbsp;return;</span></p><p dir=3D"ltr" style=3D"line-height:1.15;m=
argin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:=
Arial;color:#000000;background-color:transparent;font-weight:normal;font-st=
yle:normal;font-variant:normal;text-decoration:none;vertical-align:baseline=
"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;label1:<br></span></p><p dir=3D"ltr=
" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=
=3D"font-size:15px;font-family:Arial;color:#000000;background-color:transpa=
rent;font-weight:normal;font-style:normal;font-variant:normal;text-decorati=
on:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbs=
p;&nbsp; &nbsp;while(n--) {</span></p><p dir=3D"ltr" style=3D"line-height:1=
..15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-fa=
mily:Arial;color:#000000;background-color:transparent;font-weight:normal;fo=
nt-style:normal;font-variant:normal;text-decoration:none;vertical-align:bas=
eline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
; &nbsp;fib3=3Dnew int(*fib1+*fib2); //being constructed only now<br></span=
></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:=
0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgrou=
nd-color:transparent;font-weight:normal;font-style:normal;font-variant:norm=
al;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;*fib1=3D*fib2;</span></p>=
<p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt">=
<span style=3D"font-size:15px;font-family:Arial;color:#000000;background-co=
lor:transparent;font-weight:normal;font-style:normal;font-variant:normal;te=
xt-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;*fib2=3D*fib3;</span></p><p di=
r=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span=
 style=3D"font-size:15px;font-family:Arial;color:#000000;background-color:t=
ransparent;font-weight:normal;font-style:normal;font-variant:normal;text-de=
coration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbs=
p;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;ret_value=3Dnew int(*fib3);</span><=
/p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0p=
t"><span style=3D"font-size:15px;font-family:Arial;color:#000000;background=
-color:transparent;font-weight:normal;font-style:normal;font-variant:normal=
;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;pos=3Dp2;</span></p><p dir=
=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span =
style=3D"font-size:15px;font-family:Arial;color:#000000;background-color:tr=
ansparent;font-weight:normal;font-style:normal;font-variant:normal;text-dec=
oration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp=
;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return;</span></p><p dir=3D"ltr" sty=
le=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"fon=
t-size:15px;font-family:Arial;color:#000000;background-color:transparent;fo=
nt-weight:normal;font-style:normal;font-variant:normal;text-decoration:none=
;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;label2:</sp=
an></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-botto=
m:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgr=
ound-color:transparent;font-weight:normal;font-style:normal;font-variant:no=
rmal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;b=3Dnew A(n);</span></p=
><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"=
><span style=3D"font-size:15px;font-family:Arial;color:#000000;background-c=
olor:transparent;font-weight:normal;font-style:normal;font-variant:normal;t=
ext-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;ret_value=3Dnew int((*even)+=
=3D2);</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;ma=
rgin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000=
000;background-color:transparent;font-weight:normal;font-style:normal;font-=
variant:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;pos=3Dp3;</sp=
an></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-botto=
m:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgr=
ound-color:transparent;font-weight:normal;font-style:normal;font-variant:no=
rmal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return;</span></p><p di=
r=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span=
 style=3D"font-size:15px;font-family:Arial;color:#000000;background-color:t=
ransparent;font-weight:normal;font-style:normal;font-variant:normal;text-de=
coration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbs=
p;label3:</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt=
;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#=
000000;background-color:transparent;font-weight:normal;font-style:normal;fo=
nt-variant:normal;text-decoration:none;vertical-align:baseline">//automatic=
 variables going out of scope, and s</span><span style=3D"font-size:15px;fo=
nt-family:Arial;color:#000000;background-color:transparent;font-weight:norm=
al;font-style:normal;font-variant:normal;text-decoration:none;vertical-alig=
n:baseline"><span style=3D"font-size:15px;font-family:Arial;color:#000000;b=
ackground-color:transparent;font-weight:normal;font-style:normal;font-varia=
nt:normal;text-decoration:none;vertical-align:baseline">h</span>ould be des=
tructed<br></span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0=
pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color=
:#000000;background-color:transparent;font-weight:normal;font-style:normal;=
font-variant:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;delete b=
;</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-=
bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;b=
ackground-color:transparent;font-weight:normal;font-style:normal;font-varia=
nt:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;delete fib3;</span=
></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:=
0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgrou=
nd-color:transparent;font-weight:normal;font-style:normal;font-variant:norm=
al;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}</span></p><p dir=3D"ltr" style=3D"line-hei=
ght:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;fo=
nt-family:Arial;color:#000000;background-color:transparent;font-weight:norm=
al;font-style:normal;font-variant:normal;text-decoration:none;vertical-alig=
n:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;delete=
 even;</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;ma=
rgin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000=
000;background-color:transparent;font-weight:normal;font-style:normal;font-=
variant:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;delete fib2;</span></p><p dir=3D=
"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span sty=
le=3D"font-size:15px;font-family:Arial;color:#000000;background-color:trans=
parent;font-weight:normal;font-style:normal;font-variant:normal;text-decora=
tion:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&n=
bsp;&nbsp; &nbsp;delete fib1;</span></p><p dir=3D"ltr" style=3D"line-height=
:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-=
family:Arial;color:#000000;background-color:transparent;font-weight:normal;=
font-style:normal;font-variant:normal;text-decoration:none;vertical-align:b=
aseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;delete a;=
</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-b=
ottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;ba=
ckground-color:transparent;font-weight:normal;font-style:normal;font-varian=
t:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;pos=3Dp4;</span></p><p dir=3D"ltr" sty=
le=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"fon=
t-size:15px;font-family:Arial;color:#000000;background-color:transparent;fo=
nt-weight:normal;font-style:normal;font-variant:normal;text-decoration:none=
;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;}</span></p=
><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"=
><span style=3D"font-size:15px;font-family:Arial;color:#000000;background-c=
olor:transparent;font-weight:normal;font-style:normal;font-variant:normal;t=
ext-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; &nbsp;iterator(int n) : n(n),pos(p0) {</span></p><p dir=3D"ltr" style=3D"=
line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size=
:15px;font-family:Arial;color:#000000;background-color:transparent;font-wei=
ght:normal;font-style:normal;font-variant:normal;text-decoration:none;verti=
cal-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbs=
p;next(); //get t</span><span style=3D"font-size:15px;font-family:Arial;col=
or:#000000;background-color:transparent;font-weight:normal;font-style:norma=
l;font-variant:normal;text-decoration:none;vertical-align:baseline">he firs=
t value<br></span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0=
pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color=
:#000000;background-color:transparent;font-weight:normal;font-style:normal;=
font-variant:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp; &nbsp;}</span></p><p dir=3D"ltr" style=3D"line-heigh=
t:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font=
-family:Arial;color:#000000;background-color:transparent;font-weight:normal=
;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:=
baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;iterator() : pos(p4) {}</sp=
an></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-botto=
m:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgr=
ound-color:transparent;font-weight:normal;font-style:normal;font-variant:no=
rmal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;publi=
c:</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin=
-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;=
background-color:transparent;font-weight:normal;font-style:normal;font-vari=
ant:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; &nbsp;iterator &amp;operator++() {</span></p><p dir=3D"ltr" s=
tyle=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"f=
ont-size:15px;font-family:Arial;color:#000000;background-color:transparent;=
font-weight:normal;font-style:normal;font-variant:normal;text-decoration:no=
ne;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nb=
sp; &nbsp;delete ret_value;</span></p><p dir=3D"ltr" style=3D"line-height:1=
..15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-fa=
mily:Arial;color:#000000;background-color:transparent;font-weight:normal;fo=
nt-style:normal;font-variant:normal;text-decoration:none;vertical-align:bas=
eline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;next();</sp=
an></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-botto=
m:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgr=
ound-color:transparent;font-weight:normal;font-style:normal;font-variant:no=
rmal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return *this;</span></p><p dir=3D"ltr" sty=
le=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"fon=
t-size:15px;font-family:Arial;color:#000000;background-color:transparent;fo=
nt-weight:normal;font-style:normal;font-variant:normal;text-decoration:none=
;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;}</span></p=
><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"=
><span style=3D"font-size:15px;font-family:Arial;color:#000000;background-c=
olor:transparent;font-weight:normal;font-style:normal;font-variant:normal;t=
ext-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; &nbsp;int &amp;operator*() {</span></p><p dir=3D"ltr" style=3D"line-heigh=
t:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font=
-family:Arial;color:#000000;background-color:transparent;font-weight:normal=
;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:=
baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return *=
ret_value;</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0p=
t;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:=
#000000;background-color:transparent;font-weight:normal;font-style:normal;f=
ont-variant:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; &nbsp;}</span></p><p dir=3D"ltr" style=3D"line-height=
:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-=
family:Arial;color:#000000;background-color:transparent;font-weight:normal;=
font-style:normal;font-variant:normal;text-decoration:none;vertical-align:b=
aseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;iterator(const iterator &amp=
;it) : n(it.n),pos(it.pos) {</span></p><p dir=3D"ltr" style=3D"line-height:=
1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-f=
amily:Arial;color:#000000;background-color:transparent;font-weight:normal;f=
ont-style:normal;font-variant:normal;text-decoration:none;vertical-align:ba=
seline">//copy only living members<br></span></p><p dir=3D"ltr" style=3D"li=
ne-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:1=
5px;font-family:Arial;color:#000000;background-color:transparent;font-weigh=
t:normal;font-style:normal;font-variant:normal;text-decoration:none;vertica=
l-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;=
if (pos&gt;p0 &amp;&amp; pos&lt;p4) {</span></p><p dir=3D"ltr" style=3D"lin=
e-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15=
px;font-family:Arial;color:#000000;background-color:transparent;font-weight=
:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical=
-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&=
nbsp;&nbsp; &nbsp;ret_value=3Dnew int(*it.ret_value);</span></p><p dir=3D"l=
tr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=
=3D"font-size:15px;font-family:Arial;color:#000000;background-color:transpa=
rent;font-weight:normal;font-style:normal;font-variant:normal;text-decorati=
on:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbs=
p;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;a=3Dnew A(*it.a);</span></p><p dir=3D"ltr=
" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=
=3D"font-size:15px;font-family:Arial;color:#000000;background-color:transpa=
rent;font-weight:normal;font-style:normal;font-variant:normal;text-decorati=
on:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbs=
p;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;fib1=3Dnew int(*it.fib1);</span></p><p di=
r=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span=
 style=3D"font-size:15px;font-family:Arial;color:#000000;background-color:t=
ransparent;font-weight:normal;font-style:normal;font-variant:normal;text-de=
coration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbs=
p;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;fib2=3Dnew int(*it.fib2);</span></p=
><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"=
><span style=3D"font-size:15px;font-family:Arial;color:#000000;background-c=
olor:transparent;font-weight:normal;font-style:normal;font-variant:normal;t=
ext-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;even=3Dnew int(*it.even);</sp=
an></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-botto=
m:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgr=
ound-color:transparent;font-weight:normal;font-style:normal;font-variant:no=
rmal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}</span></p><p dir=3D"ltr" style=3D"line-h=
eight:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;=
font-family:Arial;color:#000000;background-color:transparent;font-weight:no=
rmal;font-style:normal;font-variant:normal;text-decoration:none;vertical-al=
ign:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (=
pos&gt;p1 &amp;&amp; pos&lt;p4) fib3=3Dnew int(*it.fib3);</span></p><p dir=
=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span =
style=3D"font-size:15px;font-family:Arial;color:#000000;background-color:tr=
ansparent;font-weight:normal;font-style:normal;font-variant:normal;text-dec=
oration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp=
;&nbsp;&nbsp; &nbsp;if (pos&gt;p2 &amp;&amp; pos&lt;p4) b=3Dnew A(*it.b);</=
span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bot=
tom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;back=
ground-color:transparent;font-weight:normal;font-style:normal;font-variant:=
normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp; &nbsp;}</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin=
-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial=
;color:#000000;background-color:transparent;font-weight:normal;font-style:n=
ormal;font-variant:normal;text-decoration:none;vertical-align:baseline"> &n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;iterator(iterator &amp;&amp;it) : n(std:=
:move(it.n)),pos(it.pos) {</span></p><p dir=3D"ltr" style=3D"line-height:1.=
15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-fam=
ily:Arial;color:#000000;background-color:transparent;font-weight:normal;fon=
t-style:normal;font-variant:normal;text-decoration:none;vertical-align:base=
line"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (pos&gt;p=
0 &amp;&amp; pos&lt;p4) {</span></p><p dir=3D"ltr" style=3D"line-height:1.1=
5;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-fami=
ly:Arial;color:#000000;background-color:transparent;font-weight:normal;font=
-style:normal;font-variant:normal;text-decoration:none;vertical-align:basel=
ine"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;ret_value=3Dnew int(std::move(*it.ret_value));</span></p><p dir=3D"lt=
r" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=
=3D"font-size:15px;font-family:Arial;color:#000000;background-color:transpa=
rent;font-weight:normal;font-style:normal;font-variant:normal;text-decorati=
on:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbs=
p;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;a=3Dnew A(std::move(*it.a));</span></p><p=
 dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><s=
pan style=3D"font-size:15px;font-family:Arial;color:#000000;background-colo=
r:transparent;font-weight:normal;font-style:normal;font-variant:normal;text=
-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &=
nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;fib1=3Dnew int(std::move(*it.fib=
1));</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;marg=
in-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#00000=
0;background-color:transparent;font-weight:normal;font-style:normal;font-va=
riant:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;fib2=3Dnew int(=
std::move(*it.fib2));</span></p><p dir=3D"ltr" style=3D"line-height:1.15;ma=
rgin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:A=
rial;color:#000000;background-color:transparent;font-weight:normal;font-sty=
le:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"=
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbs=
p;even=3Dnew int(std::move(*it.even));</span></p><p dir=3D"ltr" style=3D"li=
ne-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:1=
5px;font-family:Arial;color:#000000;background-color:transparent;font-weigh=
t:normal;font-style:normal;font-variant:normal;text-decoration:none;vertica=
l-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;=
}</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-=
bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;b=
ackground-color:transparent;font-weight:normal;font-style:normal;font-varia=
nt:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (pos&gt;p1 &amp;&amp; pos&lt;p4) f=
ib3=3Dnew int(std::move(*it.fib3));</span></p><p dir=3D"ltr" style=3D"line-=
height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px=
;font-family:Arial;color:#000000;background-color:transparent;font-weight:n=
ormal;font-style:normal;font-variant:normal;text-decoration:none;vertical-a=
lign:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if =
(pos&gt;p2 &amp;&amp; pos&lt;p4) b=3Dnew A(std::move(*it.b));</span></p><p =
dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><sp=
an style=3D"font-size:15px;font-family:Arial;color:#000000;background-color=
:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-=
decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &n=
bsp;}</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;mar=
gin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#0000=
00;background-color:transparent;font-weight:normal;font-style:normal;font-v=
ariant:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp; &nbsp;~iterator() {</span></p><p dir=3D"ltr" style=3D"line=
-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15p=
x;font-family:Arial;color:#000000;background-color:transparent;font-weight:=
normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-=
align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if=
 (pos&gt;p2 &amp;&amp; pos&lt;p4) delete b;</span></p><p dir=3D"ltr" style=
=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-=
size:15px;font-family:Arial;color:#000000;background-color:transparent;font=
-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;v=
ertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;if (pos&gt;p1 &amp;&amp; pos&lt;p4) delete fib3;</span></p><p dir=3D"=
ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span styl=
e=3D"font-size:15px;font-family:Arial;color:#000000;background-color:transp=
arent;font-weight:normal;font-style:normal;font-variant:normal;text-decorat=
ion:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nb=
sp;&nbsp; &nbsp;if (pos&gt;p0 &amp;&amp; pos&lt;p4) {</span></p><p dir=3D"l=
tr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=
=3D"font-size:15px;font-family:Arial;color:#000000;background-color:transpa=
rent;font-weight:normal;font-style:normal;font-variant:normal;text-decorati=
on:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbs=
p;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;delete even;</span></p><p dir=3D"ltr" sty=
le=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"fon=
t-size:15px;font-family:Arial;color:#000000;background-color:transparent;fo=
nt-weight:normal;font-style:normal;font-variant:normal;text-decoration:none=
;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
; &nbsp;&nbsp;&nbsp; &nbsp;delete fib2;</span></p><p dir=3D"ltr" style=3D"l=
ine-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:=
15px;font-family:Arial;color:#000000;background-color:transparent;font-weig=
ht:normal;font-style:normal;font-variant:normal;text-decoration:none;vertic=
al-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp=
;&nbsp;&nbsp; &nbsp;delete fib1;</span></p><p dir=3D"ltr" style=3D"line-hei=
ght:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;fo=
nt-family:Arial;color:#000000;background-color:transparent;font-weight:norm=
al;font-style:normal;font-variant:normal;text-decoration:none;vertical-alig=
n:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;=
&nbsp; &nbsp;delete a;</span></p><p dir=3D"ltr" style=3D"line-height:1.15;m=
argin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:=
Arial;color:#000000;background-color:transparent;font-weight:normal;font-st=
yle:normal;font-variant:normal;text-decoration:none;vertical-align:baseline=
"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nb=
sp;delete ret_value;</span></p><p dir=3D"ltr" style=3D"line-height:1.15;mar=
gin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Ar=
ial;color:#000000;background-color:transparent;font-weight:normal;font-styl=
e:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}</span></p><p dir=
=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span =
style=3D"font-size:15px;font-family:Arial;color:#000000;background-color:tr=
ansparent;font-weight:normal;font-style:normal;font-variant:normal;text-dec=
oration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp=
;}</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin=
-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;=
background-color:transparent;font-weight:normal;font-style:normal;font-vari=
ant:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; &nbsp;bool operator!=3D(const iterator &amp;it) {</span></p><=
p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><=
span style=3D"font-size:15px;font-family:Arial;color:#000000;background-col=
or:transparent;font-weight:normal;font-style:normal;font-variant:normal;tex=
t-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp; &nbsp;return pos!=3Dit.pos;</span></p><p dir=3D"ltr" sty=
le=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"fon=
t-size:15px;font-family:Arial;color:#000000;background-color:transparent;fo=
nt-weight:normal;font-style:normal;font-variant:normal;text-decoration:none=
;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;}</span></p=
><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"=
><span style=3D"font-size:15px;font-family:Arial;color:#000000;background-c=
olor:transparent;font-weight:normal;font-style:normal;font-variant:normal;t=
ext-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; &nbsp;operator bool() {</span></p><p dir=3D"ltr" style=3D"line-height:1.1=
5;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-fami=
ly:Arial;color:#000000;background-color:transparent;font-weight:normal;font=
-style:normal;font-variant:normal;text-decoration:none;vertical-align:basel=
ine"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return pos&lt=
;p4; //still </span><span style=3D"font-size:15px;font-family:Arial;color:#=
000000;background-color:transparent;font-weight:normal;font-style:normal;fo=
nt-variant:normal;text-decoration:none;vertical-align:baseline">hasn't ende=
d<br></span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;mar=
gin-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#0000=
00;background-color:transparent;font-weight:normal;font-style:normal;font-v=
ariant:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp; &nbsp;}</span></p><p dir=3D"ltr" style=3D"line-height:1.15=
;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-famil=
y:Arial;color:#000000;background-color:transparent;font-weight:normal;font-=
style:normal;font-variant:normal;text-decoration:none;vertical-align:baseli=
ne"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;iterator &amp;operator=3D(const i=
terator&amp;) =3D delete;</span></p><p dir=3D"ltr" style=3D"line-height:1.1=
5;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-fami=
ly:Arial;color:#000000;background-color:transparent;font-weight:normal;font=
-style:normal;font-variant:normal;text-decoration:none;vertical-align:basel=
ine"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;friend fib_even;</span></p><p di=
r=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span=
 style=3D"font-size:15px;font-family:Arial;color:#000000;background-color:t=
ransparent;font-weight:normal;font-style:normal;font-variant:normal;text-de=
coration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;};</span></p><p d=
ir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><spa=
n style=3D"font-size:15px;font-family:Arial;color:#000000;background-color:=
transparent;font-weight:normal;font-style:normal;font-variant:normal;text-d=
ecoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;int n;</span></p=
><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"=
><span style=3D"font-size:15px;font-family:Arial;color:#000000;background-c=
olor:transparent;font-weight:normal;font-style:normal;font-variant:normal;t=
ext-decoration:none;vertical-align:baseline">public:</span></p><p dir=3D"lt=
r" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style=
=3D"font-size:15px;font-family:Arial;color:#000000;background-color:transpa=
rent;font-weight:normal;font-style:normal;font-variant:normal;text-decorati=
on:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;fib_even(int n) : n(n) =
{}</span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin=
-bottom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;=
background-color:transparent;font-weight:normal;font-style:normal;font-vari=
ant:normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp=
;iterator begin() {</span></p><p dir=3D"ltr" style=3D"line-height:1.15;marg=
in-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;font-family:Ari=
al;color:#000000;background-color:transparent;font-weight:normal;font-style=
:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;return iterator(n);</span></p><p dir=
=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span =
style=3D"font-size:15px;font-family:Arial;color:#000000;background-color:tr=
ansparent;font-weight:normal;font-style:normal;font-variant:normal;text-dec=
oration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;}</span></p><p dir=
=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span =
style=3D"font-size:15px;font-family:Arial;color:#000000;background-color:tr=
ansparent;font-weight:normal;font-style:normal;font-variant:normal;text-dec=
oration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;iterator end() {</=
span></p><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-bot=
tom:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;back=
ground-color:transparent;font-weight:normal;font-style:normal;font-variant:=
normal;text-decoration:none;vertical-align:baseline"> &nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp; &nbsp;return iterator();</span></p><p dir=3D"ltr" style=3D"line-h=
eight:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;=
font-family:Arial;color:#000000;background-color:transparent;font-weight:no=
rmal;font-style:normal;font-variant:normal;text-decoration:none;vertical-al=
ign:baseline"> &nbsp;&nbsp;&nbsp;}</span></p><p dir=3D"ltr" style=3D"line-h=
eight:1.15;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:15px;=
font-family:Arial;color:#000000;background-color:transparent;font-weight:no=
rmal;font-style:normal;font-variant:normal;text-decoration:none;vertical-al=
ign:baseline">};</span></p><br><span style=3D"font-size:15px;font-family:Ar=
ial;color:#000000;background-color:transparent;font-weight:normal;font-styl=
e:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">=
</span><p dir=3D"ltr" style=3D"line-height:1.15;margin-top:0pt;margin-botto=
m:0pt"><span style=3D"font-size:15px;font-family:Arial;color:#000000;backgr=
ound-color:transparent;font-weight:normal;font-style:normal;font-variant:no=
rmal;text-decoration:none;vertical-align:baseline">So, what do you think?</=
span></p></blockquote></blockquote>

<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 />
&nbsp;<br />
&nbsp;<br />

------=_Part_482_15419926.1372343679497--

.
