PyQwt3D has a partial interface to the following C++ std::vector templates:
The interface implements four constructors for each template instantianation - taking Cell as example:
Cell()
Cell(size)
Cell(size, item)
Cell(otherCell)
and 13 member functions - taking Cell as example:
result = cell.capacity()
cell.clear()
result = cell.empty()
result = cell.back()
result = cell.front()
result = cell.max_size()
cell.pop_back()
cell.push_back(item)
cell.reserve(size)
cell.reserve(size, item = 0)
cell.resize(size, item = 0)
result = cell.size()
cell.swap(otherCell)
Iterators are not yet implemented. However, the implementation of the Python slots __getitem__, __len__ and __setitem__ let you use those classes almost as a sequence. For instance:
>>> from Qwt3D import * >>> tf = TripleField() >>> tf.push_back(Triple(0.0, 1.0, 2.0)) >>> tf.push_back(Triple(1.0, 2.0, 3.0)) >>> for t in tf: # thanks to __getitem__ ... print t.x, t.y, t.z ... 0.0 1.0 2.0 1.0 2.0 3.0 >>> for i in range(len(tf)): # thanks to __len__ ... print tf[i].x, tf[i].y, tf[i].z ... 0.0 1.0 2.0 1.0 2.0 3.0 >>> for i in range(len(tf)): # thanks to __len__ ... tf[i] = Triple(i, 2*i, 3*i) # thanks to __setitem__ ... >>> for t in tf: # thanks to __getitem__ ... print t.x, t.y, t.z ... 0.0 0.0 0.0 1.0 2.0 3.0 >>>