Don't redeclare the enum values.
cdef cppclass Graph(AbstractGraph):
ctypedef enum SplittingHeuristic:
shs_f
foo
bar
On Monday, December 29, 2014 3:27:16 PM UTC+1, Jernej Azarija wrote:
>
> Dear sage-devel,
>
> I have another question related to Cython. I like to post them here
> instead of cython-users as it seems to me that the former is a much slower
> group. That said....
>
> The definition of the Graph class in one of the libraries is :
>
> ===================================
> class Graph : public AbstractGraph
> {
> public:
> typedef enum {
> shs_f = 0, shs_fs, shs_fl, shs_fm, shs_fsm, shs_flm
> } SplittingHeuristic;
> // blah blah blah
>
> }
> ===================================
>
> Following Cython's guide on this subject
> http://docs.cython.org/src/userguide/external_C_code.html I figured my
> definition of the wrapped class should look like:
>
> ===================================
> # blah blah blah
> cdef cppclass Graph(AbstractGraph):
> ctypedef enum SplittingHeuristic:
> shs_f = 0
> # blah blah blah
> ===================================
>
>
>
> Unfortunately, this gives me a compilation error:
>
> ===================================
> cdef cppclass Graph(AbstractGraph):
> ctypedef enum SplittingHeuristic:
> ^
> ------------------------------------------------------------
>
> sage/graphs/bliss.pyx:45:22: Syntax error in C variable declaration
> ===================================
>
> Now I think the pasted code completely isolates the issue since I am able
> to work with the Graph class (access methods) normally. The only issue
> appears when I introduce this enum thing. Hence I am wondering what exactly
> I am missing in this code?
>
>
> Best,
>
> Jernej
>
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.