ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> cpp-sig
cpp-sig
[C++-sig] Static, again...
by Scott A. Smith other posts by this author
Dec 5 2002 2:05AM messages near this date
[C++-sig] Static, again... | Re: [C++-sig] Static, again...
I also have looked over the mailing list archives and 
still don't see how things work. The example given was

>  #include <boost/python/module.hpp>
>  #include <boost/python/class.hpp>
> 
>  struct Num {
>     Num() {}
>     ~Num() {}
>     static int getDims() {return 3;}
>     int dims() {return 5;}
>  };
> 
>  BOOST_PYTHON_MODULE_INIT(numTest)
>  {
>     using namespace boost::python;
>     module numTestMod("numTest");
>     numTestMod
>        .add
>        ( class_<Num>("Num")
>          .def_init()
>          .def("getDims",&Num::getDims)
>          .def("dims", &Num::dims)
>          )
>        ;
>  }

Was the conclusion in this discussion that one cannot
use getDims with an instance of the class NOR with the
class itself? That is neither

X = Num()
X.getDims()

nor

Num.getDims()

will work? Neither works for me. David wrote that

>  We don't have a way to make true static methods yet.

So, what ways are there for using the static method? As I recall,
using the static method in Python via the class name worked OK in
BPV1. I cannot get function getDims() working in V2 with anything I've
tried. Can someone spell it out for me?

Thanks, (and thanks to Dave twice over in a single day)

Scott



_______________________________________________
C++-sig mailing list
C++-sig@[...].org
http://mail.python.org/mailman/listinfo/c++-sig
Thread:
Hugo van der Merwe
Scott A. Smith
David Abrahams
Scott A. Smith
Nicodemus
Scott A. Smith
Mike Rovner
David Abrahams
David Abrahams
Hugo van der Merwe
Hugo van der Merwe
David Abrahams
Hugo van der Merwe
David Abrahams

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved