Skip to content

Commit 9947125

Browse files
committed
refactor(functional-bind): rename
rename to bind_as_lvalue
1 parent f0972a7 commit 9947125

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed
Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#pragma once
22

33
#include "invoke.h"
4+
#include "../utility/to_lvalue.h"
45

56
namespace stdsharp
67
{
7-
inline constexpr struct bind_fn
8+
inline constexpr struct bind_as_lvalue_fn
89
{
910
private:
1011
template<typename T>
@@ -14,20 +15,26 @@ namespace stdsharp
1415
};
1516

1617
template<typename T>
17-
struct arg_wrapper<T&> : ::std::reference_wrapper<T>
18+
struct arg_wrapper<T&> : std::reference_wrapper<T>
1819
{
19-
using ::std::reference_wrapper<T>::reference_wrapper;
20+
using std::reference_wrapper<T>::reference_wrapper;
2021
};
2122

2223
template<>
2324
struct arg_wrapper<void>
2425
{
2526
};
2627

28+
template<typename T>
29+
arg_wrapper(T&) -> arg_wrapper<T&>;
30+
31+
template<typename T>
32+
arg_wrapper(T&&) -> arg_wrapper<T>;
33+
2734
static constexpr struct
2835
{
2936
template<typename T>
30-
requires ::std::same_as<template_rebind<::std::decay_t<T>, void>, arg_wrapper<void>>
37+
requires std::same_as<template_rebind<std::decay_t<T>, void>, arg_wrapper<void>>
3138
[[nodiscard]] constexpr decltype(auto) operator()(T&& wrapper) const noexcept
3239
{
3340
return cpp_forward(wrapper).get();
@@ -40,42 +47,36 @@ namespace stdsharp
4047
} extract{};
4148

4249
template<typename T>
43-
using extract_t = decltype(extract(::std::declval<T>()));
50+
using extract_t = decltype(extract(std::declval<T>()));
4451

4552
public:
4653
template<typename Func, typename... Args>
4754
constexpr auto operator()(Func&& func, Args&&... args) const noexcept( //
4855
noexcept( //
49-
::std::bind_front(
56+
std::bind_front(
5057
projected_invoke,
5158
cpp_forward(func),
5259
extract,
53-
arg_wrapper<persist_t<Args&&>>{cpp_forward(args)}...
60+
arg_wrapper{to_lvalue(cpp_forward(args))}...
5461
)
5562
)
5663
)
5764
requires requires //
5865
{
59-
::std::bind_front(
66+
std::bind_front(
6067
projected_invoke,
6168
cpp_forward(func),
6269
extract,
63-
arg_wrapper<persist_t<Args&&>>{cpp_forward(args)}...
70+
arg_wrapper{to_lvalue(cpp_forward(args))}...
6471
);
6572
}
6673
{
67-
return ::std::bind_front(
74+
return std::bind_front(
6875
projected_invoke,
6976
cpp_forward(func),
7077
extract,
71-
arg_wrapper<persist_t<Args&&>>{cpp_forward(args)}...
78+
arg_wrapper{to_lvalue(cpp_forward(args))}...
7279
);
7380
}
74-
} bind{};
75-
76-
template<typename... Args>
77-
concept bindable = ::std::invocable<bind_fn, Args...>;
78-
79-
template<typename... Args>
80-
concept nothrow_bindable = nothrow_invocable<bind_fn, Args...>;
81+
} bind_as_lvalue{};
8182
}

include/stdsharp/functional/symmetric_operations.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include "bind.h"
3+
#include "bind_as_lvlaue.h"
44
#include "operations.h"
55

66
namespace stdsharp::cpo::inline cpo_impl

0 commit comments

Comments
 (0)