CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468

    Unhappy Question about STL output iterator.

    Hi, everyone!

    My STL tutorial says,

    --------
    Assignment through the same value of the iterator should happen only once.

    ostream_iterator<int> r (cout);
    *r = 0;
    *r = 1;

    is not a valid code sequence.
    --------

    But I tried the above code sample, it works OK!
    The output is 0 and 1.

    What is the meaning of the tutorial?


    Thanks in advance,
    George

  2. #2
    Join Date
    Mar 2002
    Location
    AhuhA
    Posts
    204

    Wink GOERGE

    I think if you have tried out the code and found out it worked fine, you have to say straight outloud that your tutorial is in skepticism.
    Okay, there might be another way to explain the situation, first you cout the first value of r and then when it is given by the second value, it once again put this out up onto the screen. Is that correct ? GEORGE ?



    Regards,

  3. #3
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468

    Unhappy

    Hi, Wfranc buddies!

    I simply do not understand what the turorial is
    talking about. (As you can see in the following)

    --------
    Assignment through the same value of the iterator should happen only once.
    --------

    Can you explain it to me? Someone told me that VC is
    not a standard implementation of STL and I just have
    good luck when running the code.

    So, I really what to know what is the tutorial talking about.


    Thanks in advance,
    George

  4. #4
    Join Date
    Mar 2002
    Location
    AhuhA
    Posts
    204

    Wink Uhm

    I think the code works fine. And therefore,
    --------
    Assignment through the same value of the iterator should happen only once.

    ostream_iterator<int> r (cout);
    *r = 0;
    *r = 1;

    is not a valid code sequence.
    --------
    when you just give out such a piece of information, it might not be a correct tutorial. But it might be another answer if you give some other information above this. .



    Best Regards,

  5. #5
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468

    Unhappy

    Hi, Wfranc buddies!

    I have added the whole tutorial as the attachment
    of the reply.

    My trouble arises on page line 16, page32.

    Can you explain the meaning of the tutorial to
    me? The tutorial is the first tutorial google gives
    to me. :-)


    Thanks in advance,
    George
    Attached Files Attached Files

  6. #6
    Join Date
    Mar 2002
    Location
    AhuhA
    Posts
    204
    I sent you an PM already. Check and reply !!!




    Best Regards,

  7. #7
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468
    Thanks, Wfranc buddies!

    I have sent you the reply. Please read it.


    Cheers,
    George

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured