mimic++
v10.0.1
Toggle main menu visibility
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
11
#include "
mimic++/config/Config.hpp
"
12
#include "
mimic++/utilities/Concepts.hpp
"
13
14
#ifndef MIMICPP_DETAIL_IS_MODULE
15
#include <functional>
16
#include <type_traits>
17
#endif
18
19
MIMICPP_DETAIL_MODULE_EXPORT
namespace
mimicpp::util
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
Concepts.hpp
Config.hpp
MIMICPP_DETAIL_MODULE_EXPORT
#define MIMICPP_DETAIL_MODULE_EXPORT
Definition
Config.hpp:19
mimicpp::util
Definition
Fwd.hpp:451
mimicpp::util::unwrap_ref
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
mimic++
utilities
UnwrapRef.hpp
Generated on
for mimic++ by
1.18.0