O
static_assertSize: a a a
O
static_assertO
O
RM
RM
O
>> Like a reference, a structured binding is an alias to an existing object. Unlike a reference, the type of a structured binding does not have to be a reference type.RM
>> Like a reference, a structured binding is an alias to an existing object. Unlike a reference, the type of a structured binding does not have to be a reference type.RM
O
O
structured binding — нет, что, впрочем, должно исправиться стандартом...RM
structured binding — нет, что, впрочем, должно исправиться стандартом...O
IO
IO
O
struct Foo {
using type = void;
int value = 0;
};
// Это работает, ибо почему нет?
Foo foo1;
using FooAlias1 = decltype(foo1)::type;
// Упс, уже не работает, ссылка — не класс
// Foo& foo2 = foo1;
// using FooAlias2 = decltype(foo2)::type;
// А что тут у нас?
std::tuple<int, Foo> t(42, {33});
// Должно же тоже быть ссылкой
// и не компилироваться?
auto& [i, foo3] = t;
using FooAlias3 = decltype(foo3)::type;
// Но оно даже компилируется, а ещё,
// мы можем изменить значение t,
// а это ведь даже не ссылка и тем более не указатель:
foo3.value = 55;
std::cout << std::get<1>(t).value << std::endl;O
IO
O
struct Foo {
using type = void;
int value = 0;
};
// Это работает, ибо почему нет?
Foo foo1;
using FooAlias1 = decltype(foo1)::type;
// Упс, уже не работает, ссылка — не класс
// Foo& foo2 = foo1;
// using FooAlias2 = decltype(foo2)::type;
// А что тут у нас?
std::tuple<int, Foo> t(42, {33});
// Должно же тоже быть ссылкой
// и не компилироваться?
auto& [i, foo3] = t;
using FooAlias3 = decltype(foo3)::type;
// Но оно даже компилируется, а ещё,
// мы можем изменить значение t,
// а это ведь даже не ссылка и тем более не указатель:
foo3.value = 55;
std::cout << std::get<1>(t).value << std::endl;O
RM