gpt4 book ai didi

c++11 - C++0x "standard layout"

转载 作者:行者123 更新时间:2023-12-01 02:52:25 24 4
gpt4 key购买 nike

根据wikipedia “标准布局”的要求是:

  • 对所有非静态成员具有相同的访问控制(公共(public)、私有(private)、 protected )

  • 这是否会阻止具有公共(public)方法和私有(private)数据的对象成为标准布局?如此严厉的规则的理由是什么?

    最佳答案

    Does not that preclude objects with public methods and private data from ever being standard-layout?



    不,维基百科的文章有错误的措辞。 FCD 的第 9/6 节中仅提到了数据成员的不同访问控制。 ,它处理标准布局:

    A standard-layout class is a class that:
    [...]
    — has the same access control (Clause 11) for all non-static data members,

    关于c++11 - C++0x "standard layout",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4478983/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com