class XXX_API Foo
{
// codes
template <typename Value> Id2Values = std::map<std::string, std::vector<Value>>;
// other codes
};
usually, if you have a template function, you need explicitly export instantiate to the API, my question is what about alias template? Do I need to instantiate each alias? And if I do need to do this, what is the syntax? Thanks.
template function always need to explicitly instantiate and export to API, do I need to instantiate all possible alias template and export to API, this is my question.
In code maybe it is less confusing
1 2 3 4 5
#include "Foo.h"
templatevoid XXX_API Foo::loo(double val); // export to API
templatevoid XXX_API Foo::loo(int val); // export to API
templatevoid XXX_API Foo::loo(unsigned val); // export to API
For template alias do I need to do similar things too?
1 2
templateusing XXX_API Id2Values<double> ; // export alias to API, syntax likely is wrong
templateusing XXX_API Id2Values<double> ; // export alias to API, syntax likely is wrong
If there is no need to export template alias, why for functions I need but alias not?
template function always need to explicitly instantiate and export to API
No. I think that you get the terms 'instantiate' and 'export' wrong somehow.
If there is no need to export template alias, why for functions I need but alias not?
What you need in case of template is the [header] file(s) where everything necessary for that template is defined. I don't know what 'export' in this case means.