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

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

    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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    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.

  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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    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.

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, 03:23 PM
  2. A question about a question
    By hausburn in forum C++ Programming
    Replies: 3
    Last Post: 04-25-2010, 05: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, 02:51 PM
  5. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM