Primary constructor - accepts non-null pointer Asserts non-null in debug builds, undefined behavior if null in release Note: Not explicit to allow implicit conversion from T (matching GSL behavior) Note: Not constexpr in C++11 due to FL_NOT_NULL_ASSERT limitation
| 171 | // Note: Not explicit to allow implicit conversion from T (matching GSL behavior) |
| 172 | // Note: Not constexpr in C++11 due to FL_NOT_NULL_ASSERT limitation |
| 173 | not_null(T ptr) FL_NOEXCEPT : mPtr(ptr) { |
| 174 | if (mPtr == nullptr) { |
| 175 | detail::not_null_assert_failed("not_null constructed with nullptr"); |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | // Copy constructor (defaulted) |
| 180 | constexpr not_null(const not_null& other) FL_NOEXCEPT = default; |
no test coverage detected