Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


Stl problem

Stl are learning, heroes who could explain iterative function is distance ()?

List<int>; iList;
. . . 4003rd initialization iLis : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
: : Iterator p = find list<int>; (iList.begin (), iList.end (), 5);
Cout "" "before ====== : p" "" 6-12 "" endl;
Advance (p, 2); 4003rd same as p = p + 2;
Cout "" "after ====== : p" "" 6-12 "" endl;

Int k = 0
Distance (p, iList.end (), k);
Cout "" "k ======" "" k "" endl;

Use Linux compiler, the following error
Advance.cpp : In function `int main () ':
Advance.cpp:24 : no matched function for call to `distance (
Std : : _List_iterator<int, int&, int*>;&, Std : : _List_iterator<int, int&, int*>;.
Int&) '

Stl problem

The distance of the C + + standard definition is not the same as the original, it was only two parameters. This direct use :
[code]
Cout "" distance (p, iList.end ()) "" endl;
[/code]



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com