[C++-sig] vector_indexing_suite override question

Neal D. Becker ndbecker2 at verizon.net
Thu Apr 15 13:09:27 CEST 2004

I'm trying to wrap my new Ring class, which is a vector-like class.  I was
hoping to use vector_indexing_suite but override one operator.

template<class Container>
struct my_indexing_suite : public vector_indexing_suite<Container> {
  typedef typename vector_indexing_suite<Container>::index_type index_type;

   static index_type
   convert_index(Container& container, PyObject* i_) {
     throw ("help");

  class_<Ring<int> >("RI")
    .def(init<const Ring<int>&>())
    .def (my_indexing_suite<Ring<int> >())
    .def ("Shift", &Ring<int>::Shift)

This doesn't seem to work.  my_indexing_suite::convert_index is apparantly
never called.  Any suggestions?

BTW, anyone know how to test this with gdb?  I tried gdb /usr/bin/python,
run, import, ^C-c, then try to set a breakpoint in my code, but gdb doesn't
seem to know how to set the breakpoint in the shared lib code.  Is this
cause python was not compiled with -g?

More information about the Cplusplus-sig mailing list