ETLCPP / etl

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

Does ETL need a `nullptr_t` type? #922

Closed tigran2008 closed 2 months ago

tigran2008 commented 2 months ago

Seeing issue #921, I noticed that ETL doesn't have a nullptr_t. Are you for or against having an etl::nullptr_t type, and if you wouldn't mind having it, what do you think of implementing <etl/nullptr.h> like this instead?

namespace etl
{
#if ETL_CPP11_NOT_SUPPORTED
  // Use the old style C++ NULL definition.
  typedef enum { _nullptr = 0 } nullptr_t;
  #define ETL_NULLPTR (etl::_nullptr)
#else
  // Use the new style nullptr.
  typedef decltype(nullptr) nullptr_t;
  #define ETL_NULLPTR nullptr
#endif
} // namespace etl