Click here to Skip to main content
15,898,035 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: iterator. Pin
Michael Dunn3-Nov-03 16:56
sitebuilderMichael Dunn3-Nov-03 16:56 
GeneralRe: iterator. Pin
WREY3-Nov-03 17:55
WREY3-Nov-03 17:55 
GeneralRe: iterator. Pin
Stuart Dootson3-Nov-03 21:13
professionalStuart Dootson3-Nov-03 21:13 
GeneralRe: iterator. Pin
ZoogieZork3-Nov-03 19:01
ZoogieZork3-Nov-03 19:01 
GeneralRe: iterator. Pin
Stuart Dootson3-Nov-03 21:16
professionalStuart Dootson3-Nov-03 21:16 
GeneralRe: iterator. Pin
Jörgen Sigvardsson6-Nov-03 13:50
Jörgen Sigvardsson6-Nov-03 13:50 
GeneralRe: iterator. Pin
Stuart Dootson6-Nov-03 22:22
professionalStuart Dootson6-Nov-03 22:22 
GeneralRe: iterator. Pin
ZoogieZork3-Nov-03 19:14
ZoogieZork3-Nov-03 19:14 
Yikes -- sorry for the long-winded response. I forgot to mention how to find the relative position between two non-random-access iterators. The trick is to use the std::distance function:

using namespace std;
typedef list<int> intlist;

int _tmain(int argc, _TCHAR* argv[]) {

    intlist lst;
    lst.push_back(1);
    lst.push_back(2);
    lst.push_back(3);
    lst.push_back(4);
    lst.push_back(5);

    intlist::iterator iter = lst.begin();
    ++iter;
    ++iter;

    cout << static_cast<int>(distance(lst.begin(),iter)) << endl;

    return 0;
}
Outputs 2 as expected.

A warning: For bidirectional iterators, distance is a linear-time operation.

- Mike
GeneralRe: iterator. Pin
WREY3-Nov-03 22:16
WREY3-Nov-03 22:16 
GeneralDlg's; Pin
Bo Hunter3-Nov-03 12:01
Bo Hunter3-Nov-03 12:01 
GeneralRe: Dlg's; Pin
Michael Dunn3-Nov-03 16:57
sitebuilderMichael Dunn3-Nov-03 16:57 
Questioncan i set the height of the item in CListViewCtrl and add a image for every item? Pin
HeartFriend2-Nov-03 21:07
HeartFriend2-Nov-03 21:07 
AnswerRe: can i set the height of the item in CListViewCtrl and add a image for every item? Pin
Dudi Avramov3-Nov-03 4:26
Dudi Avramov3-Nov-03 4:26 
AnswerRe: can i set the height of the item in CListViewCtrl and add a image for every item? Pin
Mil104-Nov-03 2:46
Mil104-Nov-03 2:46 
QuestionOLEDB issue new with MDAC 2.8? Pin
Steve S31-Oct-03 1:37
Steve S31-Oct-03 1:37 
GeneralDHTM binary behavior Pin
jackalwisdom30-Oct-03 22:38
jackalwisdom30-Oct-03 22:38 
GeneralReference to object using handle Pin
Member 60189830-Oct-03 18:24
Member 60189830-Oct-03 18:24 
GeneralContext Menu on web page shown ... Pin
byblostas30-Oct-03 11:11
byblostas30-Oct-03 11:11 
GeneralGetting notification on &lt;CR&gt; from Edit control Pin
janman30-Oct-03 0:49
janman30-Oct-03 0:49 
GeneralRe: Getting notification on &lt;CR&gt; from Edit control Pin
umeca741-Nov-03 1:29
umeca741-Nov-03 1:29 
GeneralRe: Getting notification on &lt;CR&gt; from Edit control Pin
janman1-Nov-03 22:42
janman1-Nov-03 22:42 
GeneralRe: Getting notification on &lt;CR&gt; from Edit control Pin
Simon Cooke4-Nov-03 12:29
Simon Cooke4-Nov-03 12:29 
GeneralATL NT Service module 49,7 bug Pin
User 3842129-Oct-03 21:33
User 3842129-Oct-03 21:33 
GeneralWindowing in ATL Pin
Sakusys29-Oct-03 16:57
Sakusys29-Oct-03 16:57 
GeneralRe: Windowing in ATL Pin
Michael Dunn29-Oct-03 19:14
sitebuilderMichael Dunn29-Oct-03 19:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.