On Sun, Feb 14, 2010 at 8:39 PM, Roman Yakovenko <roman.yakove...@gmail.com> wrote: > On Sun, Feb 14, 2010 at 6:22 PM, peoro <peoro.n...@gmail.com> wrote: >> On Sat, Feb 13, 2010 at 8:05 PM, Roman Yakovenko >> <roman.yakove...@gmail.com> wrote: >>> Did you try len( x )? >>> >> >> Yes, I tried and it isn't working. >> ... >> I've been trying with SVN revisions 1814 and 1824. > > Can you create small and complete example? ( C++ code, Py++ script and > Py++ generated code )? > > Thanks >
Sure: ##### main.cpp #include <set> std::set<int> f( ) { return std::set<int>(); } ##### export.py import os from pyplusplus import module_builder here = os.path.abspath( r"." ) mb = module_builder.module_builder_t( [here + r"/main.cpp"], working_directory=here, indexing_suite_version=2 ) mb.build_code_creator( module_name='set_test_len' ) mb.write_module( here + r'/bindings.cpp' ) ##### set_test_len.py from set_test_len import * x = f() len( x ) $ python export.py INFO Parsing source file "/net/pacifico/l/disc1/home/giangran/C/boost/python/set_len_test/main.cpp" ... INFO gccxml cmd: /usr/bin/gccxml-I"/net/pacifico/l/disc1/home/giangran/C/boost/python/set_len_test" "/net/pacifico/l/disc1/home/giangran/C/boost/python/set_len_test/main.cpp" -fxml="/tmp/tmpb3p-BN.xml" INFO GCCXML version - 0.9( 1.128 ) INFO: file "named_tuple.py" - updated( 0.000000 seconds ) INFO: file "set.hpp" - updated( 0.000000 seconds ) INFO: file "slice.hpp" - updated( 0.000000 seconds ) INFO: file "element_proxy_traits.hpp" - updated( 0.000000 seconds ) INFO: file "python_iterator.hpp" - updated( 0.010000 seconds ) INFO: file "proxy_iterator.hpp" - updated( 0.000000 seconds ) INFO: file "element_proxy.hpp" - updated( 0.010000 seconds ) INFO: file "container_suite.hpp" - updated( 0.010000 seconds ) INFO: file "slice_handler.hpp" - updated( 0.000000 seconds ) INFO: file "workaround.hpp" - updated( 0.000000 seconds ) INFO: file "value_traits.hpp" - updated( 0.000000 seconds ) INFO: file "visitor.hpp" - updated( 0.000000 seconds ) INFO: file "algorithms.hpp" - updated( 0.000000 seconds ) INFO: file "vector.hpp" - updated( 0.000000 seconds ) INFO: file "methods.hpp" - updated( 0.000000 seconds ) INFO: file "deque.hpp" - updated( 0.000000 seconds ) INFO: file "shared_proxy_impl.hpp" - updated( 0.000000 seconds ) INFO: file "iterator_range.hpp" - updated( 0.000000 seconds ) INFO: file "int_slice_helper.hpp" - updated( 0.000000 seconds ) INFO: file "container_traits.hpp" - updated( 0.000000 seconds ) INFO: file "suite_utils.hpp" - updated( 0.000000 seconds ) INFO: file "list.hpp" - updated( 0.000000 seconds ) INFO: file "map.hpp" - updated( 0.000000 seconds ) INFO: file "iterator_traits.hpp" - updated( 0.000000 seconds ) INFO: file "container_proxy.hpp" - updated( 0.000000 seconds ) INFO: file "multimap.hpp" - updated( 0.000000 seconds ) INFO: file "pair.hpp" - updated( 0.000000 seconds ) INFO: file "registry_utils.hpp" - updated( 0.000000 seconds ) INFO: file "bindings.cpp" - updated( 0.000000 seconds ) $ g++ `python-config --cflags` -lboost_python -shared -fPIC bindings.cpp -o set_test_len.so cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ $ python set_test_len.py Traceback (most recent call last): File "set_test_len.py", line 3, in <module> len( x ) TypeError: object of type 'set_less__int__greater_' has no len() > -- > Roman Yakovenko > C++ Python language binding > http://www.language-binding.net/ > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig