I worked at a company that did this to great success. Well, depending on your definition of success. We had a core C++ library that ran on iOS, Android, Windows Phone, Windows CE, Windows Desktop, Linux Desktop, and honestly a handful of other platforms that I can't event remember. We ported it to Meego at one point.
The UI was not great, and looked out of place on most platforms, since we did all of the drawing in the core library. But that made the amount of platform code relatively small for any given platform, which gave us great flexibility of what we could port the calculator apps
to. That company also had a long C / C++ culture, so writing in C++ wasn't the heresy that it is in other cultures.
-I mean.. I get what you're going for, but what you're describing quickly becomes spaghetti/lasagna code password manager
. The glue code needed to do stuff like this is horrendous, and the iOS case you described above is actually the best case. Android you will have to use JNI which is basically the worst thing ever created and the definition of esoteric. Instead of maintaining 2 apps, each in understandable native code, now you have to maintain the C++, and the iOS glue code, and the Android glue code, and the iOS native code, and the Android native code. And the 2 glue codes are more difficult to maintain than normal native code because the majority of developers don't have experience with similar code, gallery locker
ensuring more errors and leaks. Only god knows how debugging works between the 2 languages.
In quick order, your effort to simplify logic in C++ resulted in an explosion of esoteric complexity. Not to mention of the problems that inherently come along with using C++ specifically, over safer languages like Swift and Kotlin.