[C++-sig] call policies help needed

Neal Becker ndbecker2 at gmail.com
Thu May 25 03:50:07 CEST 2006


Is there something wrong with this, which looks simpler to my (naive) eyes?:

struct A {};

struct B {
  B (A& _a) : a (_a) {}
  A& a;
};

static A& getA (B& b) {
  return b.a;
}

BOOST_PYTHON_MODULE(demod4)
{
  class_<A> ("A");
  class_<B> ("B", init<A&>()
                        [with_custodian_and_ward<1,2>()])
    .def ("getA", &::getA, return_internal_reference<>())
    ;
}





More information about the Cplusplus-sig mailing list