python/test/implicit.cpp
Jürgen Hunold 63f8e9f3d7 Merged revisions 41544-41546,41549-41551,41558-41561,41564,41567,41570,41573,41576-41579,41581,41583-41586,41589,41591,41594-41612,41614-41620,41622-41624,41628,41630-41635,41637,41640-41641,41643,41649-41650 via svnmerge from
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]
2007-12-16 10:12:07 +00:00

49 lines
1.0 KiB
C++

// Copyright David Abrahams 2002.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/python/class.hpp>
#include <boost/python/implicit.hpp>
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include "test_class.hpp"
using namespace boost::python;
typedef test_class<> X;
int x_value(X const& x)
{
return x.value();
}
X make_x(int n) { return X(n); }
// foo/bar -- a regression for a vc7 bug workaround
struct bar {};
struct foo
{
virtual ~foo() {}; // silence compiler warnings
virtual void f() = 0;
operator bar() const { return bar(); }
};
BOOST_PYTHON_MODULE(implicit_ext)
{
implicitly_convertible<foo,bar>();
implicitly_convertible<int,X>();
def("x_value", x_value);
def("make_x", make_x);
class_<X>("X", init<int>())
.def("value", &X::value)
.def("set", &X::set)
;
implicitly_convertible<X,int>();
}
#include "module_tail.cpp"