A drop-in replacement for std::list with 293% faster insertion, 57% faster erasure, 17% faster iteration and 77% faster sorting on average. 20-24% speed increase in use-case testing.
#
define plflist
if $argc == 0
help plflist
else
set $end = $arg0.end_iterator.node_pointer
set $current = $arg0.begin_iterator.node_pointer
set $size = 0
while $current != $end
if $argc == 2
printf "elem[%u]: ", $size
p *($arg1*)(&($current->element))
end
if $argc == 3
if $size == $arg2
printf "elem[%u]: ", $size
p *($arg1*)(&($current->element))
end
end
set $current = $current->next
set $size++
end
printf "plflist size = %u \n", $arg0.total_size
if $argc == 1
printf "plflist "
whatis $arg0
printf "Use plflist <variable_name> <element_type> to see the elements in the list.\n"
end
end
end
document plflist
Prints plf::list<T> information.
Syntax: plflist <list> <T> <idx>: Prints list size, if T defined all elements or just element at idx
Examples:
plflist l - prints list size and definition
plflist l int - prints all elements and list size
plflist l int 2 - prints the third element in the list (if exists) and list size
end
add following to your ~/.gdbinit file:
To use it in GDB: