1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Getting last element from vector

Discussion in 'C' started by beginuser, May 13, 2009.

  1. beginuser

    beginuser New Member

    Joined:
    May 13, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    i had just started working in C++ and started modifying a code which make use of vectors.
    please help me out with this.

    link_Node *pNode,*tempsegnode;; // here link_node is a class
    vector<link_Node*> *pList;

    pNode = (*pList);

    i want to find that a pNode is last in pList and if so i have to take some corrective measure.
    i tried using end() API but not able to make it working

    in other words i need to know what is last element in vector list pList and compare with pNode and if they r same i need to do some processing.

    can someone help how to find last element from pList and then compare pNode and last element.
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England

Share This Page