mimic++ v10.0.1
Loading...
Searching...
No Matches
UnwrapRef.hpp
Go to the documentation of this file.
1// Copyright Dominic (DNKpp) Koepke 2026.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at
4// https://www.boost.org/LICENSE_1_0.txt)
5
6#ifndef MIMICPP_UTILITIES_UNWRAP_REF_HPP
7#define MIMICPP_UTILITIES_UNWRAP_REF_HPP
8
9#pragma once
10
13
14#ifndef MIMICPP_DETAIL_IS_MODULE
15 #include <functional>
16 #include <type_traits>
17#endif
18
20{
27 template <typename T>
28 [[nodiscard]]
29 constexpr T& unwrap_ref(std::reference_wrapper<T> const ref) noexcept
30 {
31 return ref.get();
32 }
33
42 template <satisfies<std::is_lvalue_reference> T>
43 [[nodiscard]]
44 constexpr T& unwrap_ref(T && ref) noexcept
45 {
46 return ref;
47 }
48}
49
50#endif
51
#define MIMICPP_DETAIL_MODULE_EXPORT
Definition Config.hpp:19
Definition Fwd.hpp:451
constexpr T & unwrap_ref(std::reference_wrapper< T > const ref) noexcept
Unwraps the given std::reference_wrapper and returns the referenced object.
Definition UnwrapRef.hpp:29