Re: Python to C++ conversion substituting vectors for lists in a recursive function

2005-03-23 Thread Peter Otten
lugal wrote: Your code has an undeclared int i in main(). > gseq.erase(0); I think erase() takes a pointer, not the element index: gseq.erase(qseq.begin()); > in the recursive function. Is my C++ translation accurate from the > original Python? Coming from a Python background, you should have

Re: Python to C++ conversion substituting vectors for lists in a recursive function

2005-03-23 Thread MyHaz
I didn't look at the original code but i you should know that passing vectors directly (i.e by value) to functions is not a good idea (results in big copy), its better to use `const vector<> &` or `vector<> &` (i.e. by reference). In general you should try to reduce the number of vector coping to

Python to C++ conversion substituting vectors for lists in a recursive function

2005-03-23 Thread lugal
I'm new to C++, coming from a Python background. I wrote the following code in C++ based on the Python code found here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302478 //beginning #include #include using namespace std; void looper(vector > nseq, vector comb); vector > master;