userver: userver/utils/not_null.hpp File Reference
Loading...
Searching...
No Matches
not_null.hpp File Reference

Detailed Description

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>
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.