error in usin list with boost

G

GujuBoy

i have created a "cpp" file which has the followin code and when i try
to compile it..it does not know what "list" is..it says its
undefined..i also tried using #include <boost/python/list.hpp>

but no differe...can someone please help.

thanks

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);
}
delete []characters;
return result;

}
 
H

Heiko Wundram

Am Sonntag, 5. Juni 2005 08:13 schrieb GujuBoy:
static list retrieval_as_list(SplitText &self, int position,
int retrieveLength) {
list result;

If I'm not completely mistaken: you know that this usage should (at least
under all sensible terms) allocate a list on the stack and thus local to the
function and not on the heap, unless boost does some mumbo jumbo that I know
nothing of like starting the list with refcount=2? I don't think that's what
you want...

But for your boost usage, I have absolutely no idea! Why not write the Python
wrapper directly in C? Just as easy, probably. And from what my experience is
with using SWIG and SIP: much less errorprone...

--
--- Heiko.
see you at: http://www.stud.mh-hannover.de/~hwundram/wordpress/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBCottEf0bpgh6uVAMRAiW9AJ9mfWVEwHUNMfAt7Pq0qGbHxW0CjQCeJ5n5
cZ7Sk3TBT2CuWJsTy76qXKw=
=PQVC
-----END PGP SIGNATURE-----
 
N

Neil Hodgson

GujuBoy:
i have created a "cpp" file which has the followin code and when i try
to compile it..it does not know what "list" is..it says its
undefined..i also tried using #include <boost/python/list.hpp>

I would have expected this (except the cstdint.h line which may not
be needed but it was in the code I copied from) to already be in your
code if you are using Boost Python:

#include <boost/python.hpp>
#include <boost/cstdint.hpp>
using namespace boost::python;

Have you read the Tutorial Introduction?
http://www.boost.org/libs/python/doc/tutorial/doc/html/index.html

Neil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,240
Messages
2,571,215
Members
47,849
Latest member
RoseannKoz

Latest Threads

Top