Restricts a pointer or smart pointer to only hold non-null values.
Definition in file not_null.hpp.
Go to the source code of this file.
#include <functional>#include <memory>#include <type_traits>#include <utility>#include <userver/utils/assert.hpp>
This graph shows which files directly or indirectly include this file:Classes | |
| class | utils::NotNull< T > |
| Restricts a pointer or smart pointer to only hold non-null values. More... | |
| struct | std::hash<::utils::NotNull< T > > |
Namespaces | |
| namespace | utils |
| Utilities. | |
Typedefs | |
| template<typename U> | |
| using | utils::SharedRef = NotNull<std::shared_ptr<U>> |
A std::shared_ptr that is guaranteed to be not-null. | |
| template<typename U> | |
| using | utils::UniqueRef = NotNull<std::unique_ptr<U>> |
A std::unique_ptr that is guaranteed to be not-null. | |
Functions | |
| template<typename U, typename... Args, typename = std::enable_if_t<std::is_constructible_v<U, Args...>>> | |
| SharedRef< U > | utils::MakeSharedRef (Args &&... args) |
An equivalent of std::make_shared for SharedRef. | |
| template<typename U, typename... Args, typename = std::enable_if_t<std::is_constructible_v<U, Args...>>> | |
| UniqueRef< U > | utils::MakeUniqueRef (Args &&... args) |
An equivalent of std::make_unique for UniqueRef. | |