Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualChisser98

Posted 28 April 2013 - 10:42 AM

Ah, right.  Thanks saejox, AngelBinder was a big help.

 

Well, I guess it's pretty clear by now that I have no idea what I'm doing:

i_have_no_idea_what_i_m_doing.jpg

 

 

So, after more researching, and asking around a little on stackoverflow, I have something compiling.

 

However, now I seem to be unable to create a asSMethodPtr object...

 

I define the following struct:

 

 

struct S
{
    int f()
    {
        return 5;
    }


    int x = 10;
};
 

 

and use it thusly:

 

 

 

 

asSMethodPtr pt = asSMethodPtr<sizeof( void (S::*)() )>::Convert( AS_METHOD_AMBIGUITY_CAST( int (S::*)()) (&S::f) );
 

 

However, I get the following compile time exception:

 

 

template_tests.cpp: In function ‘int main()’:
template_tests.cpp:64:15: error: missing template arguments before ‘pt’
template_tests.cpp:64:15: error: expected ‘;’ before ‘pt’
 
 
Any idea why in the world I get that?
 
 
If I try to add an integer in there as a template, like so:

 

asSMethodPtr<16> pt = asSMethodPtr<sizeof( void (S::*)() )>::Convert( AS_METHOD_AMBIGUITY_CAST( int (S::*)()) (&S::f) );
 

 

 
I get this error instead:
template_tests.cpp: In function ‘int main()’:
template_tests.cpp:66:120: error: conversion from ‘asSFuncPtr’ to non-scalar type ‘asSMethodPtr<16>’ requested

#1Chisser98

Posted 28 April 2013 - 10:27 AM

Ah, right.  Thanks saejox, AngelBinder was a big help.

 

Well, I guess it's pretty clear by now that I have no idea what I'm doing:

i_have_no_idea_what_i_m_doing.jpg

 

 

So, after more researching, and asking around a little on stackoverflow, I have something compiling.

 

However, now I seem to be unable to create a asSMethodPtr object...

 

I define the following struct:

 

 

struct S
{
    int f()
    {
        return 5;
    }


    int x = 10;
};
 

 

and use it thusly:

 

 

 

 

asSMethodPtr pt = asSMethodPtr<sizeof( void (S::*)() )>::Convert( AS_METHOD_AMBIGUITY_CAST( int (S::*)()) (&S::f) );
 

 

However, I get the following compile time exception:

 

 

template_tests.cpp: In function ‘int main()’:
template_tests.cpp:64:15: error: missing template arguments before ‘pt’
template_tests.cpp:64:15: error: expected ‘;’ before ‘pt’
 
 
Any idea why in the world I get that?

PARTNERS