Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to return an iterator  (Read 1372 times)

0 Members and 1 Guest are viewing this topic.

rasen58

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Email
How to return an iterator
« on: October 30, 2012, 01:56:25 pm »
I want to return an iterator from the beginning of a vector from another file.
std::vector<sf::Sprite> bigAsteroidV;
bigAsteroidV.begin();
What would the function header be for that?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: How to return an iterator
« Reply #1 on: October 30, 2012, 02:06:40 pm »
std::vector<sf::Sprite>::iterator pouet();
(read/write access)

std::vector<sf::Sprite>::const_iterator pouet() const;
(read-only access)

But returning an iterator is usually not a good solution. What are you trying to do?
Laurent Gomila - SFML developer

masskiller

  • Sr. Member
  • ****
  • Posts: 284
  • Pointers to Functions rock!
    • MSN Messenger - kyogre_jb@hotmail.com
    • View Profile
    • Email
Re: How to return an iterator
« Reply #2 on: October 30, 2012, 02:53:18 pm »
Also here you could answer this kind of questions on your own.

http://www.cplusplus.com/reference/stl/

It's the documentation for all std C++ containers that use templates one way or the other as well as a bunch of other useful stuff.
Programmer, Artist, Composer and Storyline/Script Writer of "Origin of Magic". If all goes well this could turn into a commercial project!

Finally back into the programming world!

rasen58

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Email
Re: How to return an iterator
« Reply #3 on: October 30, 2012, 02:55:46 pm »
Never mind, i realized i didnt need it. thanks anyway