what's difference usage?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • momobear

    what's difference usage?

    while as I try to wrap a function using boost-python, I find a strange
    situation.
    #include <iostream>
    #include <string>
    #include <vector>
    #include <boost/python/list.hpp>
    #include <boost/python.hpp>

    using namespace boost::python;

    int printlist(list &l){
    std::vector<std ::stringa;
    a.push_back("c+ +");
    a.push_back("ja vascript");
    for (std::vector<st d::string>::ite rator p = a.begin(); p != a.end(); +
    +p)
    l.append(*p);
    return 0;
    }

    BOOST_PYTHON_MO DULE(wlist){
    def("printlist" , printlist);
    }

    in the up code,"int printlist(list &l)" at first time I missed add &
    left of l. but when I run the following python code,
    #!/usr/local/bin/python
    a = list()
    a.append('linux ')
    import wlist
    wlist.printlist (a)
    print a

    they get the same result.
    linux
    c++
    javascript

    anyone help me figure out what's wrong here. thanks.
Working...