От частного к публичному участнику одинаковое смещение?

Предположим, у меня есть класс

      struct A
{
    consteval static size_t offsetX() {
        return offsetof(A, x);
    }
    consteval static size_t offsetY() {
        return offsetof(A, y);
    }
    consteval static size_t offsetZ() {
        return offsetof(A, z);
    }
    friend class B;
    private: 
        float x, y;
        int z;
};

Теперь предположим, что я определяюB

      struct B : private A
{
    using A::x;
    using A::y;
    using A::z;
};

Гарантирует ли стандарт ISO C++ следующее:

      offsetof(B, x) == A::offsetX()
offsetof(B, y) == A::offsetY()
offsetof(B, z) == A::offsetZ()

?

Спасибо!

0 ответов

Другие вопросы по тегам