ETLCPP / etl

Embedded Template Library
https://www.etlcpp.com
MIT License
2.05k stars 372 forks source link

variant varadic default constructed state #804

Closed fermentedfly closed 4 months ago

fermentedfly commented 6 months ago

Hi,

It seems variant_varadic still contains valid type_id when default constructed, initializing to variant_npos should resolve the issue.

Regards, Manuel

semanticdiff-com[bot] commented 6 months ago

Review changes with SemanticDiff.

Chiraffollo commented 2 months ago

Hi, when I upgraded the etl library in my local project to the version 2.38.11 from 2.38.10, I stumbled across this ticket. For std::variant, it is specified that it contains an element of the first type if default constructed and thus the index must be 0. Is there a reason why the etl must differ here? If so, the creation of the first type would have to be removed in the default constructor and it would also be helpful if a note were added to the documentation that this deviates from std::variant and that the class therefore does not behave as expected.

jwellbelove commented 2 months ago

Is there a reason why the etl must differ here?

You are right, this change does look incorrect.

Chiraffollo commented 2 months ago

Should I create a pull request?

jwellbelove commented 2 months ago

No need, I'm doing a simple revert, plus a couple of extra tests to check the value initialisation.

Chiraffollo commented 2 months ago

Okay, thank you very much! Have a nice weekend.