Greetings.
I want to to bring an issue with your code to your attention. Specifically it is the issue that various variables are shadowing class members or even local variables shadowing other local variables. (For example here)
While this is technically not an error according to C++ standard, this is considered bad practice and compilation fails with '-Wshadow -Werror' on gcc or when using MSVC with /WX (or any warning is error flag enabled) and the conformance mode (/permissive-) enabled.
Cheers