fix: add missing c-tor for nesting Variants (#467)

This allows nesting variants, i.e. allows a variant to contain another variant as its value. Until now, there was no such possibility, since the default generated copy constructor would be invoked which would create a copy of source variant instead of embed the source variant as a value in the destination variant. The default generated copy constructor is kept, for it makes sense too, but a new tag-based overload is added for embedding the source variant into the destination variant.
This commit is contained in:
Stanislav Angelovič
2024-11-20 23:40:30 +01:00
committed by GitHub
parent 02ca7212d1
commit a1419ee45d
10 changed files with 67 additions and 7 deletions
@@ -81,3 +81,12 @@ TYPED_TEST(SdbusTestObject, CanAccessAssociatedPropertySetMessageInPropertySetHa
ASSERT_THAT(this->m_adaptor->m_propertySetMsg, NotNull());
ASSERT_THAT(this->m_adaptor->m_propertySetSender, Not(IsEmpty()));
}
TYPED_TEST(SdbusTestObject, WritesAndReadsReadWriteVariantPropertySuccessfully)
{
sdbus::Variant newActionValue{5678};
this->m_proxy->actionVariant(newActionValue);
ASSERT_THAT(this->m_proxy->actionVariant().template get<int>(), Eq(5678));
}