あるとすればstd::array< T, 0 >
、なぜそれは空ではないのですか?私は次のように「空」を意味します:
std::is_empty< std::array< int, 0 > >::value
戻っfalse
て
#include <iostream>
#include <tuple>
#include <array>
struct Empty {};
int main()
{
std::cout << sizeof(std::tuple<int>) << std::endl;
std::cout << sizeof(std::tuple<int,Empty>) << std::endl;
std::cout << sizeof(std::tuple<int,std::array<int,0>>) << std::endl;
}
収量
4
4
8
つまり、std::array<int,0>
の場合、空のベース最適化(EBO)は適用されません。
std::tuple<>
(注:テンプレートパラメータがない)が空である、つまり、をstd::is_empty<std::tuple<>>::value
生成することを考えると、これは私には特に奇妙に思えますtrue
。
質問:サイズ0
がすでに特殊なケースであるとすると、それはなぜstd::array
ですか?それは意図的なものですか、それとも規格の見落としですか?