What does "static" mean in the context of declaring global template functions?
Posted
by
smf68
on Stack Overflow
See other posts from Stack Overflow
or by smf68
Published on 2014-06-13T09:20:44Z
Indexed on
2014/06/13
9:24 UTC
Read the original article
Hit count: 168
I know what static means in the context of declaring global non-template functions (see e.g. What is a "static" function?), which is useful if you write a helper function in a header that is included from several different locations and want to avoid "duplicate definition" errors.
So my question is: What does static mean in the context of declaring global template functions? Please note that I'm specifically asking about global, non-member template functions that do not belong to a class.
In other words, what is the difference between the following two:
template <typename T>
void foo(T t)
{
/* implementation of foo here */
}
template <typename T>
static void bar(T t)
{
/* implementation of bar here */
}
© Stack Overflow or respective owner