We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
value_to_function
1 parent 7a0f5e3 commit 77cd2dfCopy full SHA for 77cd2df
source/bounded/value_to_function.cpp
@@ -11,6 +11,8 @@ namespace bounded {
11
12
export template<typename T>
13
struct value_to_function {
14
+ static_assert(std::is_reference_v<T>);
15
+
16
constexpr explicit value_to_function(T && ref) noexcept:
17
m_ptr(std::addressof(ref))
18
{
@@ -19,8 +21,8 @@ struct value_to_function {
19
21
constexpr auto operator()() const & noexcept -> T & {
20
22
return *m_ptr;
23
}
- constexpr auto operator()() && noexcept -> T && {
- return static_cast<T &&>(*m_ptr);
24
+ constexpr auto operator()() const && noexcept -> T {
25
+ return static_cast<T>(*m_ptr);
26
27
28
private:
0 commit comments