Go to the documentation of this file.
4 #ifndef LEXY_DETAIL_LAZY_INIT_HPP_INCLUDED
5 #define LEXY_DETAIL_LAZY_INIT_HPP_INCLUDED
24 template <
typename... Args>
42 template <
typename... Args>
62 if (
_init && other._init)
64 else if (
_init && !other._init)
69 else if (!
_init && other._init)
86 return std::is_trivially_destructible_v<T>
87 && std::is_trivially_copy_constructible_v<T>
88 && std::is_trivially_copy_assignable_v<T>
89 && std::is_trivially_move_constructible_v<T>
90 && std::is_trivially_move_assignable_v<T>;
93 using _lazy_init_storage = std::conditional_t<_lazy_init_trivial<T>, _lazy_init_storage_trivial<T>,
102 constexpr
lazy_init() noexcept = default;
104 template <typename... Args>
113 template <
typename Fn,
typename... Args>
119 constexpr
explicit operator bool() const noexcept
148 return &this->_value;
153 return &this->_value;
157 template <
typename... Args>
158 constexpr
explicit lazy_init(
int, Args&&... args) noexcept
162 template <
typename T>
177 template <
typename Fn,
typename... Args>
183 constexpr
explicit operator bool() const noexcept
185 return _ptr !=
nullptr;
216 template <
typename Fn,
typename... Args>
223 constexpr
explicit operator bool() const noexcept
233 #endif // LEXY_DETAIL_LAZY_INIT_HPP_INCLUDED
constexpr lazy_init() noexcept
constexpr T * operator->() const noexcept
_lazy_init_storage_non_trivial & operator=(_lazy_init_storage_non_trivial &&other) noexcept
constexpr T && operator*() &&noexcept
constexpr const T && operator*() const &&noexcept
constexpr lazy_init(int, Args &&... args) noexcept
constexpr void emplace_result(Fn &&fn, Args &&... args)
constexpr T & emplace_result(Fn &&fn, Args &&... args)
constexpr _lazy_init_storage_non_trivial(int, Args &&... args)
#define LEXY_PRECONDITION(Expr)
_lazy_init_storage_non_trivial(_lazy_init_storage_non_trivial &&other) noexcept
constexpr _lazy_init_storage_trivial() noexcept
constexpr const T * operator->() const noexcept
constexpr T & emplace(Args &&... args)
constexpr T & emplace_result(Fn &&fn, Args &&... args)
std::conditional_t< _lazy_init_trivial< T >, _lazy_init_storage_trivial< T >, _lazy_init_storage_non_trivial< T > > _lazy_init_storage
constexpr _lazy_init_storage_non_trivial() noexcept
constexpr _lazy_init_storage_trivial(int, Args &&... args)
~_lazy_init_storage_non_trivial() noexcept
constexpr T * operator->() noexcept
constexpr T & operator*() &noexcept
constexpr T & emplace(T &ref)
constexpr auto _lazy_init_trivial
constexpr lazy_init() noexcept=default
constexpr T & operator*() const noexcept
constexpr lazy_init() noexcept
constexpr const T & operator*() const &noexcept