Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
1fafd1b4
Unverified
Commit
1fafd1b4
authored
Aug 06, 2021
by
Henry Schreiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: apply simpler expression with fewer workarounds
parent
5f4d7259
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
include/pybind11/detail/type_caster_base.h
+4
-5
No files found.
include/pybind11/detail/type_caster_base.h
View file @
1fafd1b4
...
@@ -927,18 +927,17 @@ protected:
...
@@ -927,18 +927,17 @@ protected:
using
Constructor
=
void
*
(
*
)(
const
void
*
);
using
Constructor
=
void
*
(
*
)(
const
void
*
);
/* Only enabled when the types are {copy,move}-constructible *and* when the type
/* Only enabled when the types are {copy,move}-constructible *and* when the type
does not have a private operator new implementation. */
does not have a private operator new implementation. A comma operator is used in the decltype
argument to apply SFINAE to the public copy/move constructors.*/
template
<
typename
T
,
typename
=
enable_if_t
<
is_copy_constructible
<
T
>::
value
>>
template
<
typename
T
,
typename
=
enable_if_t
<
is_copy_constructible
<
T
>::
value
>>
static
auto
make_copy_constructor
(
const
T
*
x
)
->
decltype
(
new
T
(
*
x
),
Constructor
{})
{
static
auto
make_copy_constructor
(
const
T
*
)
->
decltype
(
new
T
(
std
::
declval
<
const
T
>
()),
Constructor
{})
{
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100
(
x
);
return
[](
const
void
*
arg
)
->
void
*
{
return
[](
const
void
*
arg
)
->
void
*
{
return
new
T
(
*
reinterpret_cast
<
const
T
*>
(
arg
));
return
new
T
(
*
reinterpret_cast
<
const
T
*>
(
arg
));
};
};
}
}
template
<
typename
T
,
typename
=
enable_if_t
<
std
::
is_move_constructible
<
T
>::
value
>>
template
<
typename
T
,
typename
=
enable_if_t
<
std
::
is_move_constructible
<
T
>::
value
>>
static
auto
make_move_constructor
(
const
T
*
x
)
->
decltype
(
new
T
(
std
::
move
(
*
const_cast
<
T
*>
(
x
))),
Constructor
{})
{
static
auto
make_move_constructor
(
const
T
*
)
->
decltype
(
new
T
(
std
::
declval
<
T
&&>
()),
Constructor
{})
{
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100
(
x
);
return
[](
const
void
*
arg
)
->
void
*
{
return
[](
const
void
*
arg
)
->
void
*
{
return
new
T
(
std
::
move
(
*
const_cast
<
T
*>
(
reinterpret_cast
<
const
T
*>
(
arg
))));
return
new
T
(
std
::
move
(
*
const_cast
<
T
*>
(
reinterpret_cast
<
const
T
*>
(
arg
))));
};
};
...
...
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