mercredi 23 février 2022

Execute method on expression end in C++?

I'm designing a custom task management system. For this I'm overloading the + and - operators so they gain an alternative meaning:

const auto& scope = fsm::enter +STATE_TO_SET -LOCK_TO_ACQUIRE;

You can imagine that STATE_TO_SET and LOCK_TO_ACQUIRE are both enum values which are "added" to the objects member variables one after another. Now, there should be a method in the fsm::enter-object that triggers once all + and - operations are done (e.g. to set the state and acquire the lock). Is this doable somehow in C++11?

Aucun commentaire:

Enregistrer un commentaire