Sign in to follow this  
break_r

[.net] Exporting templates from .NET assemblies

Recommended Posts

In an STL.NET header like: <cliext/vector> they have vector defined as: template<typename _Value_t> ref class vector : public impl::vector_base<_Value_t>, Generic::ICollection<_Value_t> { ... } A template on a ref class that implements a couple of generic ref interfaces. And of course, after using namespace cliext, you can go: vector<int>^ v = gcnew vector<int>; So how do they pull off this magic? How do they export a template from an assembly? If I create a DLL with the following: template<typename T> public ref class Foo { }; It's not visible to an application using that assembly as a reference. And why would it. Templates are C++ specific and compile time. So how do I pull off something similar to vector? Regards.

Share this post


Link to post
Share on other sites
Oh, there is no STL.NET assembly. You're just adding the header, which is a self-contained definition.

Instantiate the template and go...

NVM! =P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this