Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
687327c9
Commit
687327c9
authored
Dec 03, 2021
by
Max Kellermann
Committed by
Max Kellermann
Dec 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/BindMethod: merge structs {Method,Function}SignatureHelper into one
parent
26dc37bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
17 deletions
+10
-17
BindMethod.hxx
src/util/BindMethod.hxx
+10
-17
No files found.
src/util/BindMethod.hxx
View file @
687327c9
...
...
@@ -82,15 +82,15 @@ public:
namespace
BindMethodDetail
{
/**
* Helper class which introspects a method pointer type.
* Helper class which introspects a method
/function
pointer type.
*
* @param M the method pointer type
* @param M the method
/function
pointer type
*/
template
<
typename
M
>
struct
Method
SignatureHelper
;
struct
SignatureHelper
;
template
<
typename
R
,
bool
NoExcept
,
typename
T
,
typename
...
Args
>
struct
Method
SignatureHelper
<
R
(
T
::*
)(
Args
...)
noexcept
(
NoExcept
)
>
{
struct
SignatureHelper
<
R
(
T
::*
)(
Args
...)
noexcept
(
NoExcept
)
>
{
/**
* The class which contains the given method (signature).
*/
...
...
@@ -106,15 +106,8 @@ struct MethodSignatureHelper<R (T::*)(Args...) noexcept(NoExcept)> {
Args
...)
noexcept
(
NoExcept
);
};
/**
* Helper class which converts a function pointer to a wrapper
* function pointer type.
*/
template
<
typename
S
>
struct
FunctionSignatureHelper
;
template
<
typename
R
,
bool
NoExcept
,
typename
...
Args
>
struct
Function
SignatureHelper
<
R
(
*
)(
Args
...)
noexcept
(
NoExcept
)
>
{
struct
SignatureHelper
<
R
(
*
)(
Args
...)
noexcept
(
NoExcept
)
>
{
typedef
R
plain_signature
(
Args
...)
noexcept
(
NoExcept
);
typedef
R
(
*
function_pointer
)(
void
*
instance
,
...
...
@@ -146,14 +139,14 @@ struct WrapperGenerator<R (*)(Args...) noexcept(NoExcept), function> {
};
template
<
auto
method
>
typename
Method
SignatureHelper
<
decltype
(
method
)
>::
function_pointer
typename
SignatureHelper
<
decltype
(
method
)
>::
function_pointer
MakeBindMethodWrapper
()
noexcept
{
return
WrapperGenerator
<
decltype
(
method
),
method
>::
Invoke
;
}
template
<
auto
function
>
typename
Function
SignatureHelper
<
decltype
(
function
)
>::
function_pointer
typename
SignatureHelper
<
decltype
(
function
)
>::
function_pointer
MakeBindFunctionWrapper
()
noexcept
{
return
WrapperGenerator
<
decltype
(
function
),
function
>::
Invoke
;
...
...
@@ -169,9 +162,9 @@ MakeBindFunctionWrapper() noexcept
*/
template
<
auto
method
>
constexpr
auto
BindMethod
(
typename
BindMethodDetail
::
Method
SignatureHelper
<
decltype
(
method
)
>::
class_type
&
instance
)
noexcept
BindMethod
(
typename
BindMethodDetail
::
SignatureHelper
<
decltype
(
method
)
>::
class_type
&
instance
)
noexcept
{
using
H
=
BindMethodDetail
::
Method
SignatureHelper
<
decltype
(
method
)
>
;
using
H
=
BindMethodDetail
::
SignatureHelper
<
decltype
(
method
)
>
;
using
plain_signature
=
typename
H
::
plain_signature
;
return
BoundMethod
<
plain_signature
>
{
&
instance
,
...
...
@@ -201,7 +194,7 @@ template<auto function>
constexpr
auto
BindFunction
()
noexcept
{
using
H
=
BindMethodDetail
::
Function
SignatureHelper
<
decltype
(
function
)
>
;
using
H
=
BindMethodDetail
::
SignatureHelper
<
decltype
(
function
)
>
;
using
plain_signature
=
typename
H
::
plain_signature
;
return
BoundMethod
<
plain_signature
>
{
nullptr
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment