Boost logo

Boost :

From: rwgk_at_[hidden]
Date: 2001-08-14 02:53:12


--- In boost_at_y..., Xavier Warin <xavier.warin_at_d...> wrote:
> The only point that didn't compile was this kind of stuff.
> class toto {
> double get(double t) {return t :}
> double get(double t,double u) {return u;}
> }

This is supported by Boost.Python:
http://www.boost.org/libs/python/doc/overloading.html

Having said that, I always get lost with the casts.
Here is an alternative:

SgOps has a method isCentric with two overloads. To bind
this to Python define free functions:

  bool SgOps_isCentric_0(const SgOps& sgo) {
    return sgo.isCentric();
  }
  bool SgOps_isCentric_1(const SgOps& sgo, const Miller::Index& H) {
    return sgo.isCentric(H);
  }

Bind these to Python:

    py_SgOps.def(SgOps_isCentric_0, "isCentric");
    py_SgOps.def(SgOps_isCentric_1, "isCentric");
    py_SgOps.def(&SgOps::isOriginCentric, "isOriginCentric");
    
This third binding is just to show the difference to "normal"
bindings.

Ralf


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk