i did the Get macro and works fine:

#define Get(x) [this]()->x

(like you see it's a lambda function header)
but i see 1 problem(sample):


like you see the type is inside of the macro function :(
but i need it:

int Get()

can anyone advice me for do these change?
i use c++ 11

2 Years
Discussion Span
Last Post by cambalinho

i'm sorry AndrisP... i'm sorry my english. but i'm trying :(
my actual macro is:

#define Get(x) [this]()->x

the 'x' is the type. but the Get() returns a 'x' value. so the 'x' must be on back of the Get()(like another functions). but i don't know change that with macros :(


What are you trying to do with this? From what I know about lambda's [this]()->x means: function that captures the this pointer and returns x and has no function body. It would be helpfull to see the use case for your macro. Also are you sure you want to use a macro? Could this be something that's solved with a template? Remember macros are evil.


NathanOliver: in these case must be a macro... at leastt i think ;)
see these propertie sample:

 property <int> Mousehover
               return intMouseHover;
            Set(int mousehover)
                intMouseHover = mousehover;

like you see the 'int', on 'Get', is like an argument and not like return... but the macro make it like a return value :(
so how can i change that macro for work like a normal function?


Schol-R-LEA yes;)
my property class works fine. but i only need change the Get() macro nothing more ;)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.