ETLCPP / etl

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

Adding constexpr to intrusive containers #840

Closed ZachOB closed 4 months ago

ZachOB commented 4 months ago

Adding constexpr to the intrusive containers. I was able to build and run tests for c++11, 14, and 17. c++20 had some issues with char8_t so I was unable to run those. c++03 was very broken for me but ETL_CONSTEXPR should be pre-compiled away so I don't think this could have broken anything.

semanticdiff-com[bot] commented 4 months ago

Review changes with SemanticDiff.

jwellbelove commented 4 months ago

You need to create new unit tests to test that the use of the constexpr changes compile and work correctly.

ZachOB commented 4 months ago

Looks like my use of constexpr was a little more hopeful than useful.

Both intrusive_list and intrusive_forward_list are not literal due to the clear() in their destructors. intrusive_queue and intrusive_stack have no destructors, so can be constexpr, but maybe they should call clear() in their destructors?

The only use I can think of for a constexpr queue/stack is data processing in constexpr functions, as having a standalone constexpr queue or stack seems entirely pointless.