Thread: queue.top()

  1. #1
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879

    queue.top()

    In my compiler's MSDN, it specifies that a std::queue has a member function called top() which is a synonym for front(). However, a call to top() simply does not compile on my system ("top is not a member of queue") while front() does. Is there a problem with my headers, or is there some compatibility reason?
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    You sure you aren't looking at priority_queue's documentation? If so, the documentation is wrong

    gg

  3. #3
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Quote Originally Posted by MSDN Library Visual Studio 6.0
    queue::top
    value_type& top();
    const value_type& top() const;
    The member function returns a reference to the first element of the controlled sequence, which must be non-empty.
    I guess it must be wrong Strangely however, I looked up std::queue and top() on google, and ended up on gcc's site where there was the class declaration for queue, and it also had top() declared in it. Although, thinking back, it seems that it was inside a #ifdef block of sorts.

    **Edit: Went back to the gcc site, and it turns out the page was for priority_queue after all.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed