C++ code will work natively on the iPhone and on Android. And it will probably produce the code with the best performance. Some work needs to be done to attach the code to the system. On iOS, that usually involves some form of thin Objective-C wrapper.