Comments (26)
It seems Visual Studio is still not fully conforming to the C++ spec. Pointer to member functions are stated to be allowed as compile-time constant template parameters and yet here Visual Studio is still disallowing it with a bogus error message. Shame.
from vu8.
I believe that boost::multi_index_container has a hack for this in VS inside its "boost::member" class.
I'll have to look into it.
Ah Microsoft.. when they aren't making you rewrite your HTML and CSS due to their inadequacies they're making you rewrite your C++.
from vu8.
Yes, I guess so. I normally use boost::bind with member functions. I can
test, but it'll probably take me much more time to dive into that it'll
take you.
On Sun, Jan 1, 2012 at 9:32 PM, nuisanceofcats <
[email protected]
wrote:
It seems Visual Studio is still not fully conforming to the C++ spec.
Pointer to member functions are stated to be allowed as compile-time
constant template parameters and yet here Visual Studio is still
disallowing it with a bogus error message. Shame.
Reply to this email directly or view it on GitHub:
#4 (comment)
Nico Kruithof
nghk.nl
from vu8.
This isn't a case for boost::bind as I need to be able to represent the method pointer at compile time and boost::bind is a purely runtime abstraction.
At any rate I cannot fix this in Visual Studio as I cannot afford to purchase Microsoft Windows or Visual Studio.
from vu8.
ok. I'll dive into boost::multi_index_container and see whether I can resolve the error.
By the way, Visual Studio has a free version (and a three month trial for the professional edition). But I'd rather work on linux as well.
from vu8.
It'll be a hard one I'm pushing the C++ compiler about as hard as it can go for this project.
I'd like to support Windows with all my code but I don't wish to break the law or spend that much money on a shoddy operating system.
from vu8.
Well breaking the law is okay but not over a stupid OS :)
from vu8.
Another option for me would be to use cvv8 to generate the InvocationCallback function and then add that to the vu8::Module. I like the vu8 interface better as it is cleaner, but already had the functions generated by cvv8.
from vu8.
Yeah I helped the author of cvv8 out with his template work.
Now maybe he can help me get it working in VS :)
from vu8.
Hi,
I got things working on windows by combining vu8 and cvv8:
v8::Handlev8::Value print(const v8::Arguments& args);
void sleep(double s);
vu8::Module module;
module("print", &print);
module.Set("sleep", cvv8::FunctionToInCa<void (double), ::sleep,
true>::Call);
Not very nice, but not too much boilerplate either.
Now I'd like to wrap some of my C++ classes with in a javascript class to
provide a way to interact with them from the javascript engine. So the
classes already exist in my application and I'd only like to create a
javascript interface to them. Do you know an example that I could use as a
starting point?
Best regards,
Nico
On Sun, Jan 1, 2012 at 10:18 PM, nuisanceofcats <
[email protected]
wrote:
Yeah I helped the author of cvv8 out with his template work.
Now maybe he can help me get it working in VS :)
Reply to this email directly or view it on GitHub:
#4 (comment)
Nico Kruithof
nghk.nl
from vu8.
Damn Visual Studio. Also I'm working on this in my fork, not my work account fork.
from vu8.
TSA is your work account? What kind of work do you do? Where do you live?
Nico
On Thu, Jan 19, 2012 at 1:07 PM, nuisanceofcats <
[email protected]
wrote:
Damn Visual Studio. Also I'm working on this in my fork, not my work
account fork.
Reply to this email directly or view it on GitHub:
#4 (comment)
Nico Kruithof
nghk.nl
from vu8.
I live in the UK, TSA is my work account. I code and design software there mainly in C++.
from vu8.
Is there anything I could do? Implement / test on visual studio?
from vu8.
Happy to accept patches for anything, thank you so much for your help.
The only reason I haven't accepted your other patches yet is because I wanted to discuss a few things about that with you, I'll leave a comment in that bug.
from vu8.
I'm not quite sure how to solve the error with the const member functions.
Could you point me in the right direction?
from vu8.
I'm a little confused by this one too. I woulda though the code on line 161 of Class.hpp would catch the "const" specialisation with the "T const" there. Could possibly try disabling that one on visual studio, or maybe I missed something. I have spent about half an hour looking into this and nothing has been obvious to me yet. If only I had visual studio I'd be able to test it; my gcc accepts your code fine.
from vu8.
Yeah maybe try disabling the const or non-const specialisation of Set
from vu8.
Yes, I know about gcc. It just compiles. I use both linux / os x and
windows to compile my application.
I disabled the second and third specialization and things are fine:
//template <class P, typename detail::MemFunProto<T const,
P>::method_type Ptr>
//inline Class& Set(char const *name) {
// return Method< detail::MemFun<T const, P, Ptr> >(name);
//}
//// passing v8::Arguments directly but modify return type
//template <class R, R (T::*Ptr)(const v8::Arguments&)>
//inline Class& Set(char const *name) {
// return Set<R(const v8::Arguments&), Ptr>(name);
//}
On Sat, Jan 21, 2012 at 8:45 PM, nuisanceofcats <
[email protected]
wrote:
I'm a little confused by this one too. I woulda though the code on line
161 of Class.hpp would catch the "const" specialisation with the "T const"
there. Could possibly try disabling that one on visual studio, or maybe I
missed something. I have spent about half an hour looking into this and
nothing has been obvious to me yet. If only I had visual studio I'd be able
to test it; my gcc accepts your code fine.
Reply to this email directly or view it on GitHub:
#4 (comment)
Nico Kruithof
nghk.nl
from vu8.
Can you try it just disabling the 2nd and not the 3rd... The 3rd provides a separate feature for vararg handling.
If that works then we can put an #ifdef around for visual studio. Do you know what symbol I should check for?
from vu8.
Either one of them is not enough. I don't see how the compiler can match
the third as it explicitly defines const v8::Arguments& to be the argument
and my member function doesn't have arguments. The fourth Set is fine as it
only has one template argument.
On Sat, Jan 21, 2012 at 9:33 PM, nuisanceofcats <
[email protected]
wrote:
Can you try it just disabling the 2nd and not the 3rd... The 3rd provides
a separate feature for vararg handling.If that works then we can put an #ifdef around for visual studio. Do you
know what symbol I should check for?
Reply to this email directly or view it on GitHub:
#4 (comment)
Nico Kruithof
nghk.nl
from vu8.
Hm, don't know what to say then. Pretty rubbish compiler really. Can you use mingw or cygwin under windows instead?
from vu8.
I'm compiling against the 3.8.3 version of V8, just realized that you
download something yourself in one of our build scripts. Could that make a
difference?
from vu8.
Got it compiling by renaming the last two member specializations and
disabling the second one on windows. I know it is an ugly hack to get
things working, but at least it works. I believe I sent you the commit as
well, but I'm more used to SVN than to Git.
from vu8.
The latest version from this account's fork has the cmake in for building against the system v8. You now have to force it to download an build v8 itself.
from vu8.
I better work around this by supplying specialisations with different names for broken compilers.
Then gcc can use the "Set" syntax and the other ones can use "SetConst" etc.
from vu8.
Related Issues (10)
- undefined behaviour in plugin handling HOT 3
- Is it possible to bind a class without using a module? HOT 1
- Can the factory use primitive types? HOT 2
- Keeping up with changes in the V8 API
- Reference to python2 HOT 1
- Docs "missing" HOT 3
- More visual studio compiler errors HOT 1
- Installation instructions HOT 4
- Is it possible to bind public c++ member variables to js HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vu8.