Basit türü adları
Basit tür adı, basit bir türün adıdır.Diğer bir deyişle, bir işaretçi değil bir tür başvuru, dizi ya da işlev işaretçisi.
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
auto
decltype ( expression )
Notlar
Bir basit tür adı bir iç içe-ad-ad alanını gösteren veya sınıf içeren belirleyici tarafından nitelendirilmiş olabilir.
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)
Aşağıdaki tabloda basit tür adları birlikte nasıl kullanılabileceğini gösterir.
Tür adı birleşimleri
Tür |
İle görüntülenebilir |
Comments |
---|---|---|
int |
longveya short, ancak ikisini birden |
Tür int türü anlamına gelir long int. |
long |
int veya double |
Tür long türü anlamına gelir long int. |
short |
int |
Tür short türü anlamına gelir short int. |
signed |
char, short, int, orlong |
Type signed implies signed int.Nesne türü en önemli bit signed char ve imzalı tamsayı türleri bit alanları işaret biti olarak alınır. |
unsigned |
char, short, int, orlong |
Type unsigned implies unsigned int.Nesne türü en önemli bit unsigned char ve işaretsiz tam sayı türleri bit alanları işaret biti ele değil. |