Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
a01977ec
Commit
a01977ec
authored
Apr 27, 2016
by
Wenzel Jakob
Browse files
pytypes noexcept annotations
parent
a57e51c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
include/pybind11/pytypes.h
include/pybind11/pytypes.h
+4
-4
No files found.
include/pybind11/pytypes.h
View file @
a01977ec
...
...
@@ -59,7 +59,7 @@ public:
object
(
const
object
&
o
)
:
handle
(
o
)
{
inc_ref
();
}
object
(
const
handle
&
h
,
bool
borrowed
)
:
handle
(
h
)
{
if
(
borrowed
)
inc_ref
();
}
object
(
PyObject
*
ptr
,
bool
borrowed
)
:
handle
(
ptr
)
{
if
(
borrowed
)
inc_ref
();
}
object
(
object
&&
other
)
{
m_ptr
=
other
.
m_ptr
;
other
.
m_ptr
=
nullptr
;
}
object
(
object
&&
other
)
noexcept
{
m_ptr
=
other
.
m_ptr
;
other
.
m_ptr
=
nullptr
;
}
~
object
()
{
dec_ref
();
}
handle
release
()
{
...
...
@@ -75,7 +75,7 @@ public:
return
*
this
;
}
object
&
operator
=
(
object
&&
other
)
{
object
&
operator
=
(
object
&&
other
)
noexcept
{
if
(
this
!=
&
other
)
{
handle
temp
(
m_ptr
);
m_ptr
=
other
.
m_ptr
;
...
...
@@ -230,8 +230,8 @@ NAMESPACE_END(detail)
#define PYBIND11_OBJECT_CVT(Name, Parent, CheckFun, CvtStmt) \
Name(const handle &h, bool borrowed) : Parent(h, borrowed) { CvtStmt; } \
Name(const object& o): Parent(o) { CvtStmt; } \
Name(object&& o): Parent(std::move(o)) { CvtStmt; } \
Name& operator=(object&& o) { (void) static_cast<Name&>(object::operator=(std::move(o))); CvtStmt; return *this; } \
Name(object&& o)
noexcept
: Parent(std::move(o)) { CvtStmt; } \
Name& operator=(object&& o)
noexcept
{ (void) static_cast<Name&>(object::operator=(std::move(o))); CvtStmt; return *this; } \
Name& operator=(object& o) { return static_cast<Name&>(object::operator=(o)); CvtStmt; } \
bool check() const { return m_ptr != nullptr && (bool) CheckFun(m_ptr); }
...
...
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