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 >> c++-sig
c++-sig
[C++-sig] Returning reference to member variable that's a basic type
by Joel Gerard other posts by this author
Oct 3 2003 11:03PM messages near this date
Re: [C++-sig] Re: Returning reference to member variable that's a basic type | [C++-sig] Pyste could do with return_self()
I hope this doesn't get me the dumb question of the day award but...

How do you return a pointer/reference to a member variable(a basic type) and modify it from
python?

Eg.

Class Foo
{
public:
    int *GetX() {return x;};
    int &GetY();
private:
    int *x;
}

I've tried

.def ("GetX()",&Foo::GetX, return_internal_reference<> ())
.def ("GetY()",&Foo::GetY, return_internal_reference<> ())

I have no problems returning objects, but basic types gives me this error:

d:\dev\libs\boost\boost\python\object\make_instance.hpp(25): error C2027: use of undefined t
ype
'boost::STATIC_ASSERTION_FAILURE<x> '
        with
        [
            x=false
        ]

What am I doing wrong?

Thanks,
Joel

=====
--------------------------------------
Email: joelgerard@[...].com

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

_______________________________________________
C++-sig mailing list
C++-sig@[...].org
http://mail.python.org/mailman/listinfo/c++-sig
Thread:
Pierre Barbier de Reuille
Lijun Qin
David Abrahams
Pierre Barbier de Reuille
Niall Douglas
David Abrahams
Joel Gerard
Joel Gerard

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