** Very Newbie Designer here... But love to discuss and work out the best solution possible! :)
Motivation: I want to add a tracing library, which needs to be optional in a complex and high performance disruptive need-based project.
I am thinking of using std::optional to propagate its data structures.
I am not able to find the best solution to enable and disable this library such that it produces least overhead to the running system, I have some things in mind on how to achive it:
- general, bool check
if(library_enabled) {
//do library stuff
}
- null all the functions definations + ptrs and covert all non nullables ( int, double etc ) to char
f(library_enabled) {
ptr func(arg 1, arg 2) {}
} else
void func(null) {}
can we think of some better way to solve this design problem, taking performance in mind?
Aucun commentaire:
Enregistrer un commentaire