[sclug] Iterator problem

Tim Sutton t.sutton at reading.ac.uk
Sat Oct 25 09:05:38 UTC 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

I am trying to use the stl iterator (or any other way) to loop through a 
vector that contains fpos_t pointers (STL stdio file position markers). All 
the iterator examples I can find use integers. When I try to implement them 
using fpos_t, I get compile problems (in the snippet below,  
myDataBlockMarkersVector is a pointer to the vector):

  vector<fpos_t>::iterator myFposIterator;
  for (myFposIterator = myDataBlockMarkersVector->begin(); myFposIterator != 
myDataBlockMarkersVector->end(); myFposIterator++)
  {
    myFileReader->setDataStartFPos(myFposIterator);   <-- doesnt work (304)
    myFileReader->moveToDataStart();
    myQString.sprintf("Element is %f",
                                myFileReader->getElement()
                                );
    myTextEdit->append(myQString);
  }


the prototype for the function called above is:


   /** Write property of fpos_t dataStartFPos. */ 
  virtual bool setDataStartFPos( std::fpos_t &theNewVal);

When I compile I get:

csm_dataprepview.cpp:304: no matching function for call to 
`FileReader::setDataStartFPos(__gnu_cxx::__normal_iterator<fpos_t*, 
std::vector<fpos_t, std::allocator<fpos_t> > >&)' 

FileReader.h:120: candidates are: virtual bool 
FileReader::setDataStartFPos(fpos_t&) 

Can anyone spot my error(s)?

Many thanks


- -- 
Tim Sutton
BDWorld Middleware Programmer
- -------------------------------------------------------------------
BiodiversityWorld Project
Centre for Plant Diversity & Systematics
School of Plant Sciences
The University of Reading
Reading, RG66AS, UK

Web     :   www.bdworld.org
Phone  :   +44-(0)118-378-6052  
Email    :   t.sutton [at] reading.ac.uk
(email preferred method of correspondence)
- -------------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+u8ZFZxb+GYjbYHkRAsWlAKDrCrZUQRASTp1/MqIAobb5FC5HDwCdFY2r
4o0saJ4zTpmoXJGfRjLc7uk=
=4NMK
-----END PGP SIGNATURE-----




More information about the Sclug mailing list