Hi,
I'm writing an application with intense usage of integers and one of
the operations that might have a performance impact is swapping two
numbers. I don't know the internals of the CLN library and I see there
is no swap operation in the headers.
Could someone please elaborate how much stuff happens internally when
I do the usual swap:
void swap(cl_I& a, cl_I& b) {
(1) cl_I temp;
(2) temp = a;
(3) a = b;
(4) b = temp;
(5)
}
My worst-case guess is:
(1) a sequence of constructors
(2) reconstruction of a
(3) destruction of a, reconstruction of b
(4) destruction of b, reconstruction of temp
(5) destruction of temp
Also, would massive amount of swaps lead to internal memory
fragmentation due to construction/destruction?
Thanks, Dejan