list::begin() && list::end() question

This is a discussion on list::begin() && list::end() question within the C++ Programming forums, part of the General Programming Boards category; Code: typedef pair<int,int> IntegerPair; typedef list<IntegerPair> VertexList; int u; for (VertexList::const_iterator ci = graph.begin(u) ; ci != graph.end(u) ; ++ci) ...

  1. #1
    -bleh-
    Join Date
    Aug 2010
    Location
    somewhere in this universe
    Posts
    458

    list::begin() && list::end() question

    Code:
    typedef pair<int,int> IntegerPair;
    
    typedef list<IntegerPair> VertexList;
    int u; 
    for (VertexList::const_iterator ci = graph.begin(u);  ci != graph.end(u); ++ci)
    I saw that code in a book. This got to be a typepo right? Becuuse list::end() or list::begin() don't take any argument.
    "All that we see or seem
    Is but a dream within a dream." - Poe

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,752
    So test your idea with some real code on a real compiler.

    Yes, a book can have bugs just the same as anything else.
    And yes, some books can have more bugs than others.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by Salem View Post
    So test your idea with some real code on a real compiler.

    Yes, a book can have bugs just the same as anything else.
    And yes, some books can have more bugs than others.
    I'd understand bugs; but stuff that doesn't even compile is a joke.

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,752
    Even K&R has mistakes which cause examples not to compile.

    At least the mistakes show who is paying attention (and not just copy/pasting from the book to the homework).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question bout my work
    By SirTalksAlots in forum C Programming
    Replies: 4
    Last Post: 07-18-2010, 04:23 PM
  2. A question about a question
    By hausburn in forum C++ Programming
    Replies: 3
    Last Post: 04-25-2010, 06:24 AM
  3. Replies: 7
    Last Post: 11-04-2005, 12:17 AM
  4. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 03:51 PM
  5. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 10:47 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21