Hello,

I am trying to make a wrapper for libxml's SAX api, for learning purpose, I am trying to use bind to wrap sax events in a class like this :


namespace sax {
    class document {

        public:
            document();
            ~document();

        protected:

            virtual void start_node( void *user_data, const xmlChar *name, const xmlChar **attrs );

            xmlSAXHandler m_evhdl;
            xmlParserCtxtPtr m_ctxt;
    };
}


The start_node() function is intended to be pointed by the startElement member from xmlSAXHandler ( it has same definition than start_node ).

I tried to use bind to copy function pointer in the constructor like this :


document::document() {

       // binding here
    m_evhdl.startElement = boost::bind( &document::start_node, this, _1, _2, _3 );

       // xml init
    m_ctxt = xmlCreateFileParserCtxt( "catalogue.xml" );

    m_ctxt->sax = &m_evhdl;
    xmlParseDocument( m_ctxt );
}


The issue is that I can't submit the binded function to startElement because bind submits "this" as a parameter to startElement, which is incompatible definition, so is there a solution to my binding ?

Regards
Carlos