LinkedList!int list1; scope(exit) list1.free(); LinkedList!int list2; LinkedList!int list3; list2.insertBack(1); list2.insertBack(2); list1.appendList(list2); import std.algorithm : equal; assert(equal(list1.byElement(), [1,2])); list3.insertBack(3); list3.insertBack(4); list1.appendList(list3); assert(equal(list1.byElement(), [1,2,3,4]));
Append other list. Note: Appended list should not be freed. It becomes part of this list.