Template class of of doubly-linked list with low memory consumption