Why isn't this template working?

View: New views
2 Messages — Rating Filter:   Alert me  

Why isn't this template working?

by Phlox Icon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

in the .h file:
template< typename T > T Foo( int enumType, int enumIndex );

in the cpp file:
template< typename T >
T Foo( int x, int y)
{
...
return a type of enum
}

Binding:
luabind::def( "Foo", (MySpecificEnumType(*) (int, int)) Foo < MySpecificEnumType > )

error:
unresolved external symbol "enum MySpecificEnumType __cdecl Foo<enum MySpecificEnumType>(int,int)" 

Thanks

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
luabind-user mailing list
luabind-user@...
https://lists.sourceforge.net/lists/listinfo/luabind-user

Re: Why isn't this template working?

by James Porter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Phlox Icon wrote:

> in the .h file:
> template< typename T > T Foo( int enumType, int enumIndex );
>
> in the cpp file:
> template< typename T >
> T Foo( int x, int y)
> {
> ...
> return a type of enum
> }
>
> Binding:
> luabind::def( "Foo", (MySpecificEnumType(*) (int,
> int)) Foo < MySpecificEnumType > )
>
> error:
> unresolved external symbol "enum MySpecificEnumType __cdecl
> Foo<enum MySpecificEnumType>(int,int)"

Is the binding in the same file as the definition of Foo? Otherwise, it
won't work because the compiler needs access to the full source of Foo
when instantiating a specialization of it.

- Jim


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
luabind-user mailing list
luabind-user@...
https://lists.sourceforge.net/lists/listinfo/luabind-user