I am writing a game program in C++ and have encountered an odd problem that seems to be unique to this function.
When this function is called, it executes just as expect
I would take any such behavior by a debugger with a grain of salt. Try adding a print statement inside the constructor. Most likely, you’ll find that it’s not getting called twice at all. Debuggers easily get confused about what source line they’re on.
When in doubt, use assembly level stepping in the debugger (i.e. si
/ ni
in gdb). That will remove any doubt what is truly executed.