diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2014-03-10 19:19:52 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2014-03-14 01:57:15 +0000 |
commit | 9a45a09aece8da3540250176b710bbd92c2e1b04 (patch) | |
tree | 4af0eaef1b9ddc4d4105a163c83ca787e60896a8 /Examples/test-suite | |
parent | adc3cfeb571f8dd6d072bbab52eebda0bf612656 (diff) | |
download | swig-9a45a09aece8da3540250176b710bbd92c2e1b04.tar.gz |
C++11 conversion operator example and docs added
Diffstat (limited to 'Examples/test-suite')
-rw-r--r-- | Examples/test-suite/cpp11_explicit_conversion_operators.i | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Examples/test-suite/cpp11_explicit_conversion_operators.i b/Examples/test-suite/cpp11_explicit_conversion_operators.i index 5e3ba03df..632355afc 100644 --- a/Examples/test-suite/cpp11_explicit_conversion_operators.i +++ b/Examples/test-suite/cpp11_explicit_conversion_operators.i @@ -3,6 +3,9 @@ */ %module cpp11_explicit_conversion_operators +%warnfilter(SWIGWARN_LANG_IDENTIFIER) Testable::operator bool; +%rename(AsInteger) Testable::operator int; + %inline %{ class U { @@ -24,5 +27,15 @@ public: int t; }; + +struct Testable { + // explicit conversion operator + explicit operator bool() const { + return false; + } + explicit operator int() { + return 42; + } +}; %} |