I have a successfully compiled program using Boost’s implementation of uBLAS matricies. Alas, debugging with gdb is proving problematic as I could find no way to see the contents of my matrices while debugging. When I try to see an element of a matrix V (which does exist and is full of data), I get:
(gdb) print V(1,1)
Invalid data type for function to be called.
Is there a way around this?
Thanks!
This is because GDB doesn’t support calling the overloaded
operator(). It’s trying to just callVas a function, and it’s not a function. You can write a freestanding function that you pass the matrix to and calls the operator:and GDB should be able to call that
You can also try to manually examine the representation of
Vin order to manually pull out the value you want. That’s probably going to be hard with types that use a lot of templates or meta-programming though.If you happen to be working on a platform that is supported by LLDB, it supports calling operator overloads.