I think I can partially answer your question. Although I don't know
how to expose std::pair using indexing suite, thanks to Roman
Yakovenko and his Py++ package, I can show you working example of
exporting pair using different approach:
This is *.h file with class containing variable of type std::pair
("documentation") ) .def( bp::init< int const &, int const & >(( bp::arg("__a"), bp::arg("__b") ), "documentation") ) .def_readwrite( "first", &std::pair< int, int >::first, "documentation" ) .def_readwrite( "second", &std::pair< int, int >::second, "documentation" );
bp::class_< tester_t >( "tester_t", "documentation", bp::init< int, int >(( bp::arg("a"), bp::arg("b") ), "documentation") ) .def( "compute" , (int ( ::tester_t::* )( ) )( &::tester_t::compute ) , "documentation" ) .def_readwrite( "pair_", &tester_t::pair_, "documentation" ); } You should notice that in python: pairA = module.pair_less__int_comma__int__greater_(2,3) pairB = module.pair_less__int_comma__int__greater_(2,3) pairA.first == pairB.first
True
pairA.second == pairB.second
True
BUT: pairA == pairB
False
I'm also interested in exposing std::pair using indexing suite because it perhaps make statement pairA == pairB become true. Especially if that code would be auto-generated by Py++ just like other STL containers it could be very useful. Roman Yakovenko wrote there is a chance this functionality would be added in next release of Py++. Also you can ask this question on Cplusplus-sig mailing list: http://mail.python.org/mailman/listinfo/cplusplus-sig If you find accurate answer to your question, please let me know. -- Regards Michał Nowotka