Message-Id: <3.0.2.32.19981126214518.0070f3e0@tex.lineanet.net> X-Sender: delfo AT tex DOT lineanet DOT net X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.2 (32) Date: Thu, 26 Nov 1998 21:45:18 +0100 To: djgpp AT delorie DOT com From: Stefano Del Furia Subject: Iterator problem with template (2^ version) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Reply-To: djgpp AT delorie DOT com Dear friends, just another error. i have tried to compile another simple program that i have found on Nelson's STL book. // // LIST0604.CPP // // This example program is used in Chapter 6 to // perform some *extremely* crude benchmarks on classes // vector, deque, list. This routine just inserts // a load of doubles into a container, then checks to see // how long the entire operation took. // // // // Borland 4.x workarounds // #define __MINMAX_DEFINED #include #include #include #include #include #include #include // // This template function performs the actual test. // The insertion point is determined by iterator j. // I fiddle with j to ensure that all insertions are // done in the very middle of the container. // template void test( T& a ) { time_t t1 = time( 0 ); T::iterator j = a.begin(); for ( int i = 0 ; i < 8000 ; i++ ) { if ( ( i % 256 ) == 0 ) cout << '.'; j = a.insert( j, i ); if ( i % 2 ) j++; } cout << "\n"; cout << "Size = " << a.size() << endl; cout << "Elapsed time: " << time( 0 ) - t1 << " seconds" << endl; a.erase( a.begin(), a.end() ); } // // Main just sets up the containers, then calls // the template function to test them out. // main() { cout << "Testing vector "; vector *a = new vector; test( *a ); delete a; cout << "Testing deque "; deque *b = new deque; test( *b ); delete b; cout << "Testing list "; list *c = new list; test( *c ); delete c; return 1; } But there's a problem because i getting an error on line (36) when i declare: T::iterator j = a.begin(); DJGPP last version on w95 environment TIA >>mailed by ''~`` Stefano Del Furia ( o o ) __________________________________.oooO--(_)--Oooo._ | ___/ / _/__ www.geocities.com/SiliconValley/3546/ | |/ _ / _(_-< Computer Science Department | |\_,_/_//___/ delfo AT tech-center DOT com .oooO | |ITIS "E.FERMI" Bibbiena 52010 AR IT ( ) Oooo. | |_____________________________________\ (____( )___| THEORY is when you know everything \_) ) / but nothing works. (_/ PRACTICE is when everything works but you don't know why. Our aim is to join THEORY and PRACTICE: (-: NOTHING works and we don't know WHY :-)