I have an application which has several functions in it. Each function can be called many times based on user input. However I need to execute a small segment of the code wi
Using C++11 -- use the std::call_once
std::call_once
#include std::once_flag onceFlag; { .... std::call_once ( onceFlag, [ ]{ /* my code body here runs only once */ } ); .... }