I am a Dutch citizen residing in Belgium. The Netherlands has an opt-in arrangement when it comes to post-mortem organ donors, whereas Belgium has an opt-out arrangement. When I die, which arrangement applies?
By default, the law of the country you are in would obviously apply. I am not aware of any international treaty or attempt to coordinate practices in this area, even within the EU (it can be a touchy subject so it would be difficult to get everyone on board).
I have absolutely no idea how it works in practice but formally, I don't see why your citizenship or your residence should generally make a difference. Should you die in Belgium, Belgium law would therefore apply by default. If you die during a vacation, the law of a third country could also apply.
But many opt-out countries (although by no means all) have rules under which some effort should be made to track family members and ask them about your wishes. So if you did opt in or out in your country of origin or your country of residence, this would constitute evidence that you wanted to donate your organs (or not) and physicians in other countries would often respect that.
It would also certainly be the case if you carry a donor card (some organisations offer cards in many language for this purpose). Similarly, the various donor cards I know (France, Germany…) are not the only valid ways to express a preference.
Finally, in some opt-out countries, the opt-out register is also open to non-nationals so if you are really concerned about that, you can try to register yourself before going.
The website of the German donor card includes similar information (in German) and provides a short overview of the rules in many European countries.