宣言中可能的大部分关键词

时间:2014-05-26 01:19:15

标签: c++ keyword

纯粹出于好奇,我一直想知道有多少关键字可以适用于声明。 假设模板不算数(因为无穷大),我能想出的最长模板是:

extern const unsigned long int i;

我也试图在那里适应新的。

我看了一堆,但没有看到任何关于它的事情。只是为了好玩!

修改 - 由于这个问题过于宽泛,您只能为每个不同的关键字添加一次关键字。没有例外。当然,长期是一个完全合法的类型,我只想知道可以一起使用多少不同的类型。因此,在一个声明中可以容纳多少个关键字。可以是函数,成员函数或变量。

2 个答案:

答案 0 :(得分:13)

你说声明。这里有一个function declaration,其总数为10,其中包括踢球:

int inline long constexpr volatile static unsigned const long foo() noexcept;

您可以使用member function执行12次操作:

virtual int inline long constexpr volatile unsigned const long foo() const noexcept = delete;

我不知道你会怎么做,但我相信这是variable declaration的有效二十,不包括初始化的可能性(虽然不包括那个,但包括{ {1}}有问题):

decltype

当有无数重复的可能性时,很难知道要远离什么。例如,我的变量声明没有强制转换,这就是我说允许alignas(sizeof(decltype(typeid(const volatile unsigned long long int)))) static thread_local decltype(typeid(const volatile unsigned long long int).name()) foo{}; 有问题的原因:

decltype

答案 1 :(得分:10)

这是一个几乎无限的:

thread_local constexpr static const unsigned long long*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const*
const* const* const* const* const* const* const* const* i{nullptr};

Live Example