userver: userver/utils/not_null.hpp File Reference
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
not_null.hpp File Reference

Restricts a pointer or smart pointer to only hold non-null values. More...

#include <functional>
#include <memory>
#include <type_traits>
#include <utility>
#include <userver/utils/assert.hpp>
+ Include dependency graph for not_null.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of 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>
SharedRef< Uutils::MakeSharedRef (Args &&... args)
 An equivalent of std::make_shared for SharedRef.
 
template<typename U , typename... Args>
UniqueRef< Uutils::MakeUniqueRef (Args &&... args)
 An equivalent of std::make_unique for UniqueRef.
 

Detailed Description

Restricts a pointer or smart pointer to only hold non-null values.

Definition in file not_null.hpp.