• Advertisement
Sign in to follow this  

[.net] Exporting templates from .NET assemblies

This topic is 4522 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement