Branch: Tag:

2011-12-03

2011-12-03 21:56:05 by Henrik Grubbström (Grubba) <grubba@grubba.org>

ADT.Stack: Added _search().

118:    return arr[..ptr-1];   }    + //! Return the stack-depth to @[item]. + //! + //! This function makes it possible to use + //! eg @[search()] and @[has_value()] on the stack. + protected int _search(mixed item) + { +  int i; +  for (i = ptr; i--;) { +  if (arr[i] == item) return ptr-(i+1); +  } +  return -1; + } +    //! A stack added with another stack yields a third   //! a third stack will all the stack elements from   //! the two first stacks.