13
Templates
[temp]
13.4
Template arguments
[temp.arg]
13.4.2
Template type arguments
[temp.arg.type]
1
#
A
template-argument
for a
template-parameter
which is a type shall be a
type-id
.
2
#
[
Example
1
:
template
<
class
T
>
class
X
{
}
;
template
<
class
T
>
void
f
(
T t
)
{
}
struct
{
}
unnamed_obj;
void
f
(
)
{
struct
A
{
}
;
enum
{
e1
}
;
typedef
struct
{
}
B; B b; X
<
A
>
x1;
// OK
X
<
A
*
>
x2;
// OK
X
<
B
>
x3;
// OK
f
(
e1
)
;
// OK
f
(
unnamed_obj
)
;
// OK
f
(
b
)
;
// OK
}
—
end example
]
[
Note
1
:
A template type argument can be an incomplete type (
[basic.
types]
)
.
—
end note
]