3#ifndef MRS_LIB_EXPERIMENTAL_UTILITY_PIMPL_HPP_
4#define MRS_LIB_EXPERIMENTAL_UTILITY_PIMPL_HPP_
37 template <
typename Interface,
typename StorageType = std::unique_ptr<Interface>>
44 explicit Pimpl(std::nullptr_t) =
delete;
52 explicit Pimpl(StorageType impl) : impl_(std::move(impl))
56 throw std::logic_error(
"Cannot construct Pimpl from nullptr.");
68 template <
typename T,
typename... Args>
69 explicit Pimpl(std::in_place_type_t<T>, Args&&... args) : impl_(std::make_unique<T>(std::forward<Args>(args)...))
92 assert(impl_ !=
nullptr);
101 [[nodiscard]]
const Interface&
operator*() const noexcept
103 assert(impl_ !=
nullptr);
114 assert(impl_ !=
nullptr);
125 assert(impl_ !=
nullptr);
140 return impl_ ==
nullptr;
Interface * operator->() noexcept
Arrow operator for non-const access.
Definition pimpl.hpp:112
Pimpl(std::in_place_type_t< T >, Args &&... args)
Construct the wrapped object in place.
Definition pimpl.hpp:69
Pimpl(const Pimpl &)=delete
Pimpl is not copyable.
~Pimpl()=default
Default destructor.
Pimpl & operator=(Pimpl &&)=default
Default move assignment operator.
const Interface & operator*() const noexcept
Dereference operator for const access.
Definition pimpl.hpp:101
Pimpl(std::nullptr_t)=delete
Deleted constructor to prevent construction from nullptr.
const Interface * operator->() const noexcept
Arrow operator for const access.
Definition pimpl.hpp:123
bool valueless_after_move() const noexcept
Checks if the object is in moved from state.
Definition pimpl.hpp:138
Pimpl(StorageType impl)
Construct Pimpl from a pointer to the object.
Definition pimpl.hpp:52
Pimpl & operator=(const Pimpl &)=delete
Pimpl is not copyable.
Interface & operator*() noexcept
Dereference operator for non-const access.
Definition pimpl.hpp:90
Pimpl(Pimpl &&)=default
Default move constructor.
All mrs_lib functions, classes, variables and definitions are contained in this namespace.
Definition attitude_converter.h:24