/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Examples/test-suite/java/cpp11_using_functor_runme.java
23 строки
830 B
William S Fulton
C++11: cpp11_using_functor - Overloaded functor with %rename and %template
28 май 2026, 22:16
28 май 2026, 22:16
54cabe9
Код
Авторство
О чём код?
import cpp11_using_functor.*; public class cpp11_using_functor_runme { static { try { System.loadLibrary("cpp11_using_functor"); } catch (UnsatisfiedLinkError e) { System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); System.exit(1); } } public static void main(String argv[]) { // Overloaded helper built from two concrete functor base classes (C++11 form). // operator() is renamed to call() by %rename, giving an overloaded proxy method. OverloadedIntDouble ov = new OverloadedIntDouble(); if (!ov.call(7).equals("Int:7")) throw new RuntimeException("ov.call(7)"); if (!ov.call(2.5).equals("Double:2.500000")) throw new RuntimeException("ov.call(2.5)"); } }