ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/util.h
(Generate patch)

Comparing deliantra/server/include/util.h (file contents):
Revision 1.118 by root, Tue Jan 3 11:25:33 2012 UTC vs.
Revision 1.119 by root, Thu Jan 26 19:01:22 2012 UTC

654 } 654 }
655}; 655};
656 656
657// This container blends advantages of linked lists 657// This container blends advantages of linked lists
658// (efficiency) with vectors (random access) by 658// (efficiency) with vectors (random access) by
659// by using an unordered vector and storing the vector 659// using an unordered vector and storing the vector
660// index inside the object. 660// index inside the object.
661// 661//
662// + memory-efficient on most 64 bit archs 662// + memory-efficient on most 64 bit archs
663// + O(1) insert/remove 663// + O(1) insert/remove
664// + free unique (but varying) id for inserted objects 664// + free unique (but varying) id for inserted objects
701 insert (&obj); 701 insert (&obj);
702 } 702 }
703 703
704 void erase (T *obj) 704 void erase (T *obj)
705 { 705 {
706 unsigned int pos = obj->*indexmember; 706 object_vector_index pos = obj->*indexmember;
707 obj->*indexmember = 0; 707 obj->*indexmember = 0;
708 708
709 if (pos < this->size ()) 709 if (pos < this->size ())
710 { 710 {
711 (*this)[pos - 1] = (*this)[this->size () - 1]; 711 (*this)[pos - 1] = (*this)[this->size () - 1];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines