63f8e9f3d7
https://svn.boost.org/svn/boost/trunk ........ r41544 | jhunold | 2007-12-01 20:27:06 +0100 (Sa, 01 Dez 2007) | 2 lines Silence compiler by adding cosmetic virtual destructors. ........ r41549 | jhunold | 2007-12-01 21:24:51 +0100 (Sa, 01 Dez 2007) | 2 lines Silence compiler by adding cosmetic virtual destructors. ........ r41550 | jhunold | 2007-12-01 21:26:37 +0100 (Sa, 01 Dez 2007) | 3 lines Remove unused paramters. Add -Wextra to gcc flags to enable more warnings. ........ r41577 | jhunold | 2007-12-02 12:51:08 +0100 (So, 02 Dez 2007) | 3 lines Revert revisions 41544 and 41549. See http://lists.boost.org/Archives/boost/2007/12/131116.php for details. ........ r41649 | jhunold | 2007-12-03 19:47:17 +0100 (Mo, 03 Dez 2007) | 2 lines Silence unused paramter warning in release mode. ........ r41650 | jhunold | 2007-12-03 19:51:26 +0100 (Mo, 03 Dez 2007) | 2 lines Add cosmetic virtual detructors to silence compile warnings. ........ [SVN r42094]
43 lines
809 B
C++
43 lines
809 B
C++
#include "boost/python.hpp"
|
|
#include <memory>
|
|
|
|
struct vector
|
|
{
|
|
virtual ~vector() {}
|
|
|
|
vector operator+( const vector& ) const
|
|
{ return vector(); }
|
|
|
|
vector& operator+=( const vector& )
|
|
{ return *this; }
|
|
|
|
vector operator-() const
|
|
{ return *this; }
|
|
};
|
|
|
|
struct dvector : vector
|
|
{};
|
|
|
|
using namespace boost::python;
|
|
|
|
struct vector_wrapper
|
|
: vector, wrapper< vector >
|
|
{
|
|
vector_wrapper(vector const&) {}
|
|
vector_wrapper() {}
|
|
};
|
|
|
|
BOOST_PYTHON_MODULE( operators_wrapper_ext )
|
|
{
|
|
class_< vector_wrapper >( "vector" )
|
|
.def( self + self )
|
|
.def( self += self )
|
|
.def( -self )
|
|
;
|
|
|
|
scope().attr("v") = vector();
|
|
std::auto_ptr<vector> dp(new dvector);
|
|
register_ptr_to_python< std::auto_ptr<vector> >();
|
|
scope().attr("d") = dp;
|
|
}
|