irr::core::list<typename T> - who the f*** did program

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
TomTim
Posts: 72
Joined: Mon Aug 16, 2010 5:32 pm
Location: NRW, Germany

irr::core::list<typename T> - who the f*** did program

Post by TomTim »

I just don't get it. I am trying to find a list node by its value, but there's no function. Further more, I am not even able to delete last inserted nodes, the equivalent to std::list<typename T>::pop (_back and _front). But even those functions don't return the values of the nodes if I wanna 'pop' them.

So I wonder what I should do?

EDIT: Stupid question, program it myself, the source code is available after all ...
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

why so aggressive? if you need help with something, just ask and we will help as we can.

who the f*** did program is just ridiculous.........
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

You need to iterate over the list ..
Working on game: Marrbles (Currently stopped).
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

TomTim wrote:I just don't get it.
And since you don't understand it, it must be wrong...
TomTim wrote:I am trying to find a list node by its value, but there's no function.
So write one? Or use an existing algorithm from the C++ Standard Library.

Code: Select all

template<class Iterator, class Predicate>
Iterator my_find_if(Iterator beg, Iterator end, Predicate pred)
{
  for (/**/; beg != end; ++beg) {
    if (pred(*beg))
      break;
  }

  return beg;
}

template <class Iterator, class T>
Iterator my_find(Iterator beg, Iterator end, const T& val)
{
  for (/**/; beg != end; ++beg) {
    if (*beg == val)
      break;
  }

  return beg;
}
TomTim wrote:Further more, I am not even able to delete last inserted nodes, the equivalent to std::list<typename T>::pop (_back and _front).
This sounds like a personal problem. The functionality is there, you just have to use it...

Code: Select all

// assuming my_list is not empty (same as the requirement for std::list<T>::pop_back() and std::list<T>::pop_front())

// same as pop_back()
my_list.erase(my_list.getLast());

// same as pop_front()
my_list.erase(my_list.begin());
TomTim wrote:But even those functions don't return the values of the nodes if I wanna 'pop' them.
The equivalent functions in the C++ Standard Library don't remove and return the element either. They both return void to avoid exception safety problems.

Travis
loki1985
Posts: 214
Joined: Thu Mar 31, 2005 2:36 pm

Post by loki1985 »

@TomTim:

being stupid and agressively blaming others for it.

your behaviour is a disgrace and harming the reputation of other germans, like me. so drop it.
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

loki1985 wrote:your behaviour is a disgrace and harming the reputation of other germans, like me. so drop it.
Don't worry about that too much; his aggressiveness speaks only for himself.
Post Reply