Iterator(3U) InterViews Reference Manual Iterator(3U)NAME
Iterator - marks a position in a data structure
SYNOPSIS
#include <Unidraw/iterator.h>
DESCRIPTION
An iterator marks a position in a data structure, generally during a traversal of some sort. For example, an iterator keeps track of the
current position when iterating through a list of elements. Unidraw's Iterator class serves this purpose in conjunction with ULists or
objects that use them.
PUBLIC OPERATIONS
Iterator()
Iterator(Iterator&)
Construct a new iterator. The second constructor initializes the iterator's value to that of the given iterator.
virtual void SetValue(void*)
virtual void* GetValue()
Classes that use an iterator must store position information in it. These operations set and get the this information.
SEE ALSO UList(3U)Unidraw 11 June 1990 Iterator(3U)
Check Out this Related Man Page
UHashTable(3U) InterViews Reference Manual UHashTable(3U)NAME
UHashTable, UHashElem - hash table classes
SYNOPSIS
#include <Unidraw/uhash.h>
DESCRIPTION
UHashTable implements a simple open hash table. The number of slots can be specified when the table is created. UHashTable stores
UHashElem instances, which contain the key that is hashed. Code that uses UHashTables may derive from UHashElem to store data in addition
to the key. UHashTable also provides operations for iterating over the elements in the hash table.
UHASHELEM OPERATIONS
UHashElem(void* = nil)
Create a UHashElem with the given key value.
void* GetKey()
void SetKey(void*)
Explicitly get and set the element's key value.
UHASHTABLE PUBLIC OPERATIONS
UHashTable(int nslots)
Create a new UHashTable, specifying its number of slots.
virtual void Register(void* key, UHashElem* = nil)
Make an entry into the hash table. If no UHashElem is supplied, this function call the CreateElem function (described below) to
create one, and it will call SetKey (with key as its argument) on the result.
virtual void Unregister(void* key)
Remove the element with the matching key from the hash table and delete it.
void First(Iterator&)
void Next(Iterator&)
boolean Done(Iterator)
UHashElem* GetElem(Iterator)
Operations for iterating over the elements in the hash table. These operation do not guarantee a particular ordering for the itera-
tion. First initializes an iterator to point to the first element in the traversal, Next increments the iterator to point to the
following element, and Done returns whether or not the iterator points beyond the last element in the traversal. GetElem returns
the element to which the given iterator points.
UHashElem* Find(void* key)
Find the element with the matching key (as defined by the Equal operation, described below) in the hash table.
UHASHTABLE PROTECTED OPERATIONS
virtual UHashElem* CreateElem()
Return a new UHashElem instance. Subclasses of UHashTable should redefine this function if they use subclasses of UHashElem.
virtual int Hash(void* key)
Hash the specified key to return a slot index. This value should be less than the value of the _nslots member variable.
virtual boolean Equal(void* key1, void* key2)
Return whether the specified keys are equivalent. By default, Equal simply compares the pointers for equality. Subclasses may
redefine this operation to make more sophisticated comparisons.
SEE ALSO Iterator(3U)Unidraw 3 October 1990 UHashTable(3U)
I have a question about iterators. Here is the code I have
template <typename element>
void merge_sort(vector<element> &v)
{
element::iterator lo;
}
Now thats all the code I have for the non-recursive merge sort at the moment, which obvioulsy isn't a lot, but I need... (0 Replies)
Is is possible to make STL-Iterator to work with user defined class ,like the one below?
#include <iostream>
#include <stdexcept>
using namespace std;
template <class T>
class Array
{
public:
T& operator (unsigned i) throw(out_of_range)
{ return data_; }
protected:
... (2 Replies)
Hi,
I'm having trouble compling the following code in Sun C++ (under sun studio 10). I found that it is issue with libCstd library. It can be resolved if i used stdport lib. However, i have no choice but to use libCstd. Does anyone know what can be done to resolve the issue? :confused:
... (0 Replies)
I am unable to resolve the below code compilation issue:
class A
{
public:
int x;
};
void sort_A(TArray<A> &_Atype)
{
std::stable_sort (_Atype.begin(), _Atype.end());
}
bool operator< (const A & _a1, const A & _a2)
{
return _a1.x < _a2.x;
}
When we compile using gcc 4.1.2... (4 Replies)
I get following compile time errors on HP ITANIUM machine
"/opt/include_std/limit", line 268: error # 2321: data member initializer is not allowed
_RWSTD_STATIC_CONST (bool, is_specialized = false);
"/opt/include_std/rw/iterator", line 119: error # 2247: class template "std::iterator_traits"... (0 Replies)
Okay so I am currently workng on an assignment where I have basically got to create a word ladder, eg. Click, Clock, Flock, Flick, so its a list of words with only 1 letter difference, and the same letters cant be reused. Now I can do 2 methods of doing this, the first (which I need help need help... (2 Replies)
I am trying to reverse complement DNA sequence (string) with a short c++ code using boost library. Code was compiled without any warning/error, but ran into Segmentation fault.
My guess is the function to return a vector, but not sure.
#include <iostream>
#include <fstream>
#include <string>... (14 Replies)