[C++-sig] Conversion from python objects to c++ objects for argument passing

Nicodemus nicodemus at globalite.com.br
Sat Nov 30 00:43:03 CET 2002

God, I'm embaressed. I found the bug. And it couldn't be more stupid. 
The error is in my PrintVec function:

void PrintVec( const vector<int> &v )
    vector<int>::const_iterator it = v.begin();
    stringstream ss;
    ss << "C++: [";
    while ( it != v.end() ){
        if ( it != v.begin() ){
            ss << ", ";
        ss << *it;
    ss << "]";
    cout << ss.str() << endl;

I forgot to update the iterator inside the while loop!!! grrrr...

Anyway. The code from scitbx works perfectly. The code that I posted 
earlier (pylist_to_vector) also works, but, as Ralf mentioned, is not 

I'm really ashamed of myself.

Thanks for your time Ralf, and sorry for wasting your time.
Bruno da Silva de Oliveira.

Ralf W. Grosse-Kunstleve wrote:

>--- Nicodemus <nicodemus at globalite.com.br> wrote:
>>I had checked the FAQ and tried this code before I posted earlier, but 
>>it gave me the same result (the application locks in a loop in that same 
>>line). Any other ideas of what maybe wrong?
>The converters are known to work on a number of platforms. The only problem
>that I am aware of are internal compiler errors reported by others using the
>Visual C++ optimizer (I am not aware of problems when the optimizer is not
>Could you post a minimal example that I could use to reproduce your problem?
>Please be specific about the OS, compiler, compiler/linker options used.
>Do you Yahoo!?
>Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
>C++-sig mailing list
>C++-sig at python.org
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.cpp
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20021129/eabdebbb/attachment.txt>

More information about the Cplusplus-sig mailing list