Почему в App Store Connect есть два снимка размером 12,9 "?

Вы можете использовать объединение для этого (требуется C ++ 11):

#include <new>

class Foo {
    public:
        Foo(int a) { }
};

class Bar {
    public:
        Bar() {
            new(&m_foo) Foo(42); // call the constructor
            // you can use m_foo from this point
        }

        ~Bar() {
            m_foo.~Foo(); // call the destructor
        }

    private:
        union { // anonymous union
            Foo m_foo;
        };
};

Обратите внимание, что вам нужно явно вызвать деструктор m_foo в ~Bar().

0
задан rmaddy 19 January 2019 в 22:42
поделиться