Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.

exort and template

max-divulskiy
Beginner
232 Views
Good afternoon.
I have a question concerning use keyword export the templates. I want to share template advertisement and its implementation using the keyword export (do not want to pull very large .h files).
For example like this all works:
[bash]#ifndef ETEMPLATE_H
#define ETEMPLATE_H

template  
void SomeFnc (T const&);

#include "ETemplate.cpp"

#endif // ETEMPLATE_H[/bash]
[bash]//ETemplate.cpp
#include "stdafx.h" template void SomeFnc (T const& x) { printf("All work\n"); }[/bash]
But by using the export i have errors:
[bash]#ifndef ETEMPLATE_H
#define ETEMPLATE_H

export
template  
void SomeFnc (T const&);

#endif // ETEMPLATE_H[/bash]
[bash]//ETemplate.cpp
#include "stdafx.h"
#include "ETemplate.h"

export
template 
void SomeFnc (T const& x)
{
	printf("Dont work\n");
}[/bash]

Tell my how to use correct export.
Thanks in advance.
0 Kudos
1 Solution
Judith_W_Intel
Employee
232 Views

export template is not implemented on our Windows platform.

It is implemented on our Linux platforms (if you use the -export switch) but you might want to think twice about using it, I would recomment that you read:

http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1426.pdf


My advice:

If it's compile time you're worried about, use precompiled headers.
If it's name pollution, use namespaces.

Judy

View solution in original post

2 Replies
Judith_W_Intel
Employee
233 Views

export template is not implemented on our Windows platform.

It is implemented on our Linux platforms (if you use the -export switch) but you might want to think twice about using it, I would recomment that you read:

http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1426.pdf


My advice:

If it's compile time you're worried about, use precompiled headers.
If it's name pollution, use namespaces.

Judy
max-divulskiy
Beginner
232 Views
Thanks for the advice.
Reply