using boost to return list

Neil Hodgson nyamatongwe+thunder at gmail.com
Sat Jun 4 17:59:17 EDT 2005


GujuBoy:

> i am trying to make a "cpp" file which will make an array and pass it
> to python as a list.
> 
> how is this possible...i am using BOOST...please can someone point me
> at some examples

    This returns a list when called from Python.

static list retrieval_as_list(SplitText &self, int position,
         int retrieveLength) {
	list result;

	int *characters = new int[retrieveLength];
	int lenRet = self.RetrieveUTF32(position, characters, 	
                 retrieveLength);
	for (int i=0;i<lenRet;i++) {
		result.append(characters[i]);
	}
	delete []characters;
	return result;
}

    Neil



More information about the Python-list mailing list