Community
cancel
Showing results for 
Search instead for 
Did you mean: 
max-divulskiy
Beginner
84 Views

exort and template

Jump to solution
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

Accepted Solutions
Judith_W_Intel
Employee
84 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
85 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

max-divulskiy
Beginner
84 Views
Thanks for the advice.