[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] gcc (OK) vs. g++ (failure)?

From: Tamas Nepusz
Subject: Re: [igraph] gcc (OK) vs. g++ (failure)?
Date: Thu, 24 Feb 2011 10:23:18 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20101208 Lightning/1.0b2 Thunderbird/3.1.7


I would like to know whether there is any means to make the below piece of code (igraph_get_shortest_paths_dijkstra.c, which is providen in the \example\simple together with igraph) work for c++?

Try this:

#define VECTOR_PTR(v) ((igraph_vector_t**)(v).stor_begin)

then replace every occurrence of VECTOR(vecs)[i] where vecs is of type igraph_vector_ptr_t with VECTOR_PTR(vecs)[i]. The VECTOR() macro does not work in C++ with igraph_vector_ptr_t types only, it still works with igraph_vector_t. Since an igraph_vector_ptr_t may store any pointer (not just pointers to igraph_vector_t), the VECTOR macro returns values of type void*, and you have to cast that explicitly into an igraph_vector_t**; this is what the above VECTOR_PTR macro will do.

And of course make print_vector return void :)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]