Simple Type Names

A simple type name is the name of a simple type. That is, a type that is not a pointer, reference, array or function pointer.

class-name
[ :: ] nested-name-specifier type-name
[ :: ] nested-name-specifier template template-id
char
wchar_t
bool 
short
int
long
signed
unsigned
float
double
void

Remarks

A simple type name may be qualified by a nested-name-specifier, indicating the namespace or containing class.

int  // simple type name
unsigned int  // combination of simple type names 
MyClass  // a class type
class MyClass  // class is optional when using the type name
struct MyStruct  // the keyword struct is optional in C++
enum MyEnum  // the keyword enum is optional in C++
::MyClass  // type name at global scope
Outer::Inner  // nested type name
::Outer::Inner  // nested type names with global scope operator
MyTemplate<int>  // a class template
Outer::Inner<int> // an inner class template
Outer<char>::Inner<int>  // an inner class template of a template class
::template MyTemplate<int>  // using the template keyword
typename MyClass  // the typename keyword (only in a template definition)

The following table shows how the simple type names can be used together.

Type Name Combinations

Type

Can Appear With

Comments

int

long or short, but not both

Type int implies type long int.

long

int or double

Type long implies type long int.

short

int

Type short implies type short int.

signed

char, short, int, or long

Type signed implies signed int. The most-significant bit of objects of type signed char and bit fields of signed integral types is taken to be the sign bit.

unsigned

char, short, int, or long

Type unsigned implies unsigned int. The most-significant bit of objects of type unsigned char and bit fields of unsigned integral types is not treated as the sign bit.

See Also

Concepts

C++ Type Specifiers