[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

Thanks, that sorted it. :-)

Tim

On Friday 09 May 2003 4:39 pm, you wrote:
> I think fpos_t is basically an integer.
>
> I'd like to see the actual files so I can compile and test it, but I
> think your problem is that you are passing an iterator and not the value
> of the element referred to by the iterator as the function parameter.
>
> Try using
> myFileReader->setDataStartFPos(*myFposIterator);
>
> Paul.
>
> On Fri, 2003-05-09 at 16:16, Tim Sutton wrote:
> > -----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-----
> >
> > _______________________________________________
> > sclug mailing list
> > sclug at sclug.org.uk
> > http://www.sclug.org.uk/mailman/listinfo/sclug

- -- 
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+u82tZxb+GYjbYHkRAgkHAKDrEjHG6uGQnzIpO4nw5aq3MeL1yQCgqil2
n9YT8h5hXd9s7Y/LiCXo0bw=
=JnTG
-----END PGP SIGNATURE-----




More information about the Sclug mailing list