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
6fcd1c73
Commit
6fcd1c73
authored
Dec 02, 2021
by
Max Kellermann
Committed by
Max Kellermann
Dec 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/BindMethod: eliminate struct BindMethodWrapperGenerator2
parent
eca097db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
38 deletions
+9
-38
BindMethod.hxx
src/util/BindMethod.hxx
+9
-38
No files found.
src/util/BindMethod.hxx
View file @
6fcd1c73
...
...
@@ -135,23 +135,6 @@ struct MethodWrapperWithSignature<R(Args...) noexcept(NoExcept)> {
};
/**
* Generate a wrapper function. Helper class for
* #BindMethodWrapperGenerator.
*
* @param T the containing class
* @param method the method pointer
* @param R the return type
* @param Args the method arguments
*/
template
<
typename
T
,
bool
NoExcept
,
auto
method
,
typename
R
,
typename
...
Args
>
struct
BindMethodWrapperGenerator2
{
static
R
Invoke
(
void
*
_instance
,
Args
...
args
)
noexcept
(
NoExcept
)
{
auto
&
t
=
*
(
T
*
)
_instance
;
return
(
t
.
*
method
)(
std
::
forward
<
Args
>
(
args
)...);
}
};
/**
* Generate a wrapper function.
*
* @param T the containing class
...
...
@@ -163,8 +146,11 @@ struct BindMethodWrapperGenerator;
template
<
typename
T
,
bool
NoExcept
,
auto
method
,
typename
R
,
typename
...
Args
>
struct
BindMethodWrapperGenerator
<
T
,
method
,
R
(
Args
...)
noexcept
(
NoExcept
)
>
:
BindMethodWrapperGenerator2
<
T
,
NoExcept
,
method
,
R
,
Args
...
>
{
struct
BindMethodWrapperGenerator
<
T
,
method
,
R
(
Args
...)
noexcept
(
NoExcept
)
>
{
static
R
Invoke
(
void
*
_instance
,
Args
...
args
)
noexcept
(
NoExcept
)
{
auto
&
t
=
*
(
T
*
)
_instance
;
return
(
t
.
*
method
)(
std
::
forward
<
Args
>
(
args
)...);
}
};
template
<
typename
T
,
typename
S
,
...
...
@@ -199,23 +185,6 @@ struct FunctionTraits<R(Args...) noexcept(NoExcept)> {
};
/**
* Generate a wrapper function for a plain function which ignores the
* instance pointer. Helper class for
* #BindFunctionWrapperGenerator.
*
* @param F the function pointer type
* @param function the function pointer
* @param R the return type
* @param Args the function arguments
*/
template
<
bool
NoExcept
,
typename
F
,
F
function
,
typename
R
,
typename
...
Args
>
struct
BindFunctionWrapperGenerator2
{
static
R
Invoke
(
void
*
,
Args
...
args
)
noexcept
(
NoExcept
)
{
return
function
(
std
::
forward
<
Args
>
(
args
)...);
}
};
/**
* Generate a wrapper function.
*
* @param S the plain function signature type
...
...
@@ -226,8 +195,10 @@ template<typename S, typename P, P function>
struct
BindFunctionWrapperGenerator
;
template
<
typename
P
,
P
function
,
bool
NoExcept
,
typename
R
,
typename
...
Args
>
struct
BindFunctionWrapperGenerator
<
R
(
Args
...)
noexcept
(
NoExcept
),
P
,
function
>
:
BindFunctionWrapperGenerator2
<
NoExcept
,
P
,
function
,
R
,
Args
...
>
{
struct
BindFunctionWrapperGenerator
<
R
(
Args
...)
noexcept
(
NoExcept
),
P
,
function
>
{
static
R
Invoke
(
void
*
,
Args
...
args
)
noexcept
(
NoExcept
)
{
return
function
(
std
::
forward
<
Args
>
(
args
)...);
}
};
template
<
typename
T
,
typename
T
::
pointer
function
>
...
...
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