FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python/src/set.cpp at develop · FadyEssam/python · GitHub
FadyEssam
/
python
Public
forked from
boostorg/python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python
/
src
/
set.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
83 lines (68 loc) · 1.53 KB
Breadcrumbs
python
/
src
/
set.cpp
Copy path
File metadata and controls
83 lines (68 loc) · 1.53 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//
Copyright Fady Essam 2019. Distributed under the Boost
//
Software License, Version 1.0. (See accompanying
//
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
include
<
boost/python/set.hpp
>
namespace
boost
{
namespace
python
{
namespace
detail
{
detail::new_non_null_reference
set_base::call
(object_cref arg_)
{
return
(detail::new_non_null_reference)
(expect_non_null)(
PySet_New
(arg_.
ptr
())
);
}
set_base::set_base
()
: object(detail::new_reference(PySet_New(
NULL
)))
{}
set_base::set_base
(object_cref sequence)
: object(set_base::call(sequence))
{}
void
set_base::add
(object_cref x)
{
if
(
PyAnySet_CheckExact
(
this
->
ptr
()))
{
if
(
PySet_Add
(
this
->
ptr
(), x.
ptr
()) == -
1
)
throw_error_already_set
();
}
else
{
this
->
attr
(
"
add
"
)(x);
}
}
void
set_base::discard
(object_cref x)
{
if
(
PyAnySet_CheckExact
(
this
->
ptr
()))
{
if
(
PySet_Discard
(
this
->
ptr
(), x.
ptr
()) == -
1
)
throw_error_already_set
();
}
else
{
this
->
attr
(
"
discrad
"
)(x);
}
}
object
set_base::pop
()
{
return
this
->
attr
(
"
pop
"
)();
}
void
set_base::clear
()
{
this
->
attr
(
"
clear
"
)();
}
long
set_base::__len__
()
{
return
extract<
long
>(
object
(
PySet_Size
(
this
->
ptr
())))();
}
static
struct
register_set_pytype_ptr
{
register_set_pytype_ptr
()
{
const_cast
<converter::registration &>(
converter::registry::lookup
(boost::python::type_id<boost::python::set>())
).
m_class_object
= &PySet_Type;
}
}register_set_pytype_ptr_;
}
}
}
Back
|
FazBrowse Home
|
New Git URL