i have a task in doubly linked lists in c++

  c++, data-structures

Write a function void movetoList(T &val1, T &val2, DLL& resultList) such that it
moves all nodes of value val where val >= val1 and val <=val2 to resultList.
(are not allowed to create or delete nodes).
 Ex. If List L1 has {23, 10, 8, 7, 4, 21, 12}, then L1.move2List (10, 30, L3) will make nodes
23,10,21,12 be part of list L3 and L1 will become {8, 7, 4}.

Source: Windows Questions C++