A C++ Library that defines a templated XOR-Linked List.
-
This is a templeated XOR-linked list library. You can generate and populate a list with :
- STL iterators (for example
Vector::begin()
andVector::end()
) - STL containers (
Vector
,List
,Map
,initializer_list
...) - arrays
- single element
- or nothing.
- STL iterators (for example
-
Implemented all
std::list
methods. Try to#define list XorLinkedList
:) -
Inherited from
std::iterator
, so feel free to use#include <algorithm>
or range-based for! -
Full move semantics supported, try
std::move
Try
#include "XorLinkedList.hpp"
main.cpp
is a sample and simple & naive test.
Good old double Linked list has 2 fields of address pointers, prev
and next
. Actually, this implementation is not memory efficient: we only need 1 field, by which prev
and next
can be computed.
curr->ptr = prev ^ next
next = curr->ptr ^ prev
prev = curr->ptr ^ next
xplorld AT gmail DOT com
MIT.
Welcome pull requests!