« first day (1060 days earlier)      last day (2017 days later) » 

nwp
nwp
06:27
@LanYi std::decay_t is probably better, but I haven't used it enough to be aware of pitfalls.
 
3 hours later…
09:14
How can I create a pointer to an instance function? is there any way at all?
nwp
nwp
Same way you always do. You put an & before the member function to get a pointer to member function (technically it's not a pointer, but close enough).
but I need to maintain the context in the function
std::function.?
I'm getting errors because the function has to be static
nwp
nwp
What context? You mean the this pointer?
You can make a std::pair<Class *, Returntype (Class::*)(Args)> for example. But yeah, std::function or a lambda is probably much easier.
[object] { return object.function(); } may be what you really want.
09:17
would it help if I mention I'm using v8?
nwp
nwp
I don't know what v8 is, so apparently not.
oh
It's chrome's JavaScript engine
nwp
nwp
That doesn't sound like C++.
hi. it's going to be a completely out of topic question, but maybe someone of you will redirect me to the right place. I'm a 4th year undergraduate student, i have 1y. 8mo. commercial experience in embedded project (linux/networking related, I had mid dev work and salary as for my country).
well, not JavaScript, no, but since it's written in C++, you write addons in C++ too
09:19
It's so happen that I will not receive degree in this year - despite I had left the job to get ready for diploma, but since I have some health issues, I've decided to postpone it for a year. now I'm looking for opportunity to travel - does not matter in what direction, I want to apply at place and work for 1-1.5-2 years. without a degree EU seems to be closed for me - so East is left. any recommendations.?
@GreenTree you typed that very quickly
nwp
nwp
Copy/paste is magic.
oh yeah, that exists
nwp
nwp
@JacobSchneider If it is actual C++ then you should be able to use C++. Check what version of C++ it is. Lambdas were added in C++11. If you want to call C++ functions from JS then I have no clue how that is supposed to work.
no that's not it
@nwp

So I've got a class, Window.
It contains a bunch of methods. One of them is `Background(int r, int g, int b)`
And, obviously, it sets the background colour of the window.
Now, I'm exposing a function to JS so it can be called. But with this code:

`v8::Local <v8::FunctionTemplate> bgfnc = v8::FunctionTemplate::New(isolate, Background);`

I get the following error:

`window.cpp(44): error C3867: 'Window::Background': non-standard syntax; use '&' to create a pointer to member`

Perhaps it threw you off a bit by saying I'm scripting v8, but that's unimportant. I'm quite confident this ha
what happened to formatting
nwp
nwp
09:27
Can't mix multi-line code formatting and regular text because SO never cared to implement that.
hm
well it was formatted in GH
it's got a timeout on the message editing
you can share code though ideone.com for instance
yeah, but I can't be bothered :P
nwp
nwp
The compiler is saying that you can't simply use Background here and need to use &Window::Background instead. Maybe try that.
That would require I make it static, right?
nwp
nwp
09:30
No.
nwp
nwp
You can get pointers* to non-`static` functions just fine.
*(not actually pointers)
it's a pointer to member, as far as I understood.
mate, that's made my life SOOO much easer!
I'd tried &Background but not &Window:Background
nwp
nwp
Of course in order to use such a function pointer you do need to provide a Window instance.
09:32
how would I provide it?
(forgive me, I'm new to C++)
nwp
nwp
auto fp = &Window::Background;
Window w;
(w.*fp)(args);
I think that was the syntax. Let me check.
nwp
nwp
The compiler ate it, so it's probably good.
haha, thank you so much
nwp
nwp
@GreenTree There is no general ban on working in the EU without a degree. If you are non-EU resident from a non-privileged country the employer effectively has to fill out a form saying that they really need you and were unable to find anyone else with sufficient qualifications given the constraints. They just have to want you enough to fill out the paper work.
Alternatively consider studying abroad. Should be much easier to get into.
09:49
@nwp I've left off the (args) because I don't have any args to give it and the FunctionTemplate takes a function pointer, but then I get error C2298: missing call to bound pointer to member function. What does it mean?
nwp
nwp
Probably that you forgot the () to call the function.
but I don't want to call it
nwp
nwp
What do you want to do with it then?
The FunctionTemplate Class takes a callback parameter in its New method. I want to pass it into there
nwp
nwp
You have to see what type of callback it wants. If it wants a regular function pointer and just call that you can't give it a pointer to member function.
If it takes anything callable you can pass a lambda.
09:53
no it wants a regular pointer
nwp
nwp
Try passing [w] { return w.f(); } as the callback.
I get a bunch of errors
I'm pretty sure I can't use . and have to use-> instead
and what is w?
is that the window instance?
nwp
nwp
It was Window w;. If it's a pointer then yeah, need to use ->.
okay thanks
can I use this instead?
nwp
nwp
yes
09:57
okay thanks
nwp
nwp
[this] { return f(); } should work from inside of a non-static member function.
'f': is not a member of 'Window'
do I just make a quick function?
nwp
nwp
Well, you probably want to use Background or whatever the function was called.
You put in the function you want to call.
from the getting started guide I found you can use SetNamedPropertyHandler
Right, duh
Okay, that seems to work
 
3 hours later…
12:50
Is it possible for a derived class to call it's base class Ctor from it's own Ctor with parameters and to give those parameters to its base class Ctor ??
@Shago Of course yes
Ok, when I have a Base Class Shape and i want the Ctor to do this
Shape(std::list<Shape*> &shapes) {
shapes.push_back(this);
}
And i just want the Derrived classes to send the parameter &shapes to their base CTor
13:18
Thank you !

« first day (1060 days earlier)      last day (2017 days later) »