Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
cython
Commits
9f69fd5e
Commit
9f69fd5e
authored
Sep 15, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement const-correct cypclass dict without excessive use of 'mutable' qualifier
parent
a7a448d6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
Cython/Includes/libcythonplus/dict.pxd
Cython/Includes/libcythonplus/dict.pxd
+10
-10
No files found.
Cython/Includes/libcythonplus/dict.pxd
View file @
9f69fd5e
...
...
@@ -125,20 +125,20 @@ cdef cypclass cypdict[K, V]:
ctypedef
V
value_type
ctypedef
pair
[
key_type
,
value_type
]
item_type
ctypedef
vector
[
item_type
].
size_type
size_type
ctypedef
dict_key_iterator_t
[
const
cypdict
[
K
,
V
],
vector
[
item_type
].
iterator
,
key_type
]
iterator
ctypedef
dict_keys_view_t
[
const
cypdict
[
K
,
V
],
vector
[
item_type
].
iterator
,
key_type
]
keys_view
ctypedef
dict_values_view_t
[
const
cypdict
[
K
,
V
],
vector
[
item_type
].
iterator
,
value_type
]
values_view
ctypedef
dict_items_view_t
[
const
cypdict
[
K
,
V
],
vector
[
item_type
].
iterator
,
item_type
]
items_view
ctypedef
dict_key_iterator_t
[
const
cypdict
[
K
,
V
],
vector
[
item_type
].
const_
iterator
,
key_type
]
iterator
ctypedef
dict_keys_view_t
[
const
cypdict
[
K
,
V
],
vector
[
item_type
].
const_
iterator
,
key_type
]
keys_view
ctypedef
dict_values_view_t
[
const
cypdict
[
K
,
V
],
vector
[
item_type
].
const_
iterator
,
value_type
]
values_view
ctypedef
dict_items_view_t
[
const
cypdict
[
K
,
V
],
vector
[
item_type
].
const_
iterator
,
item_type
]
items_view
mutable
vector
[
item_type
]
_items
mutable
unordered_map
[
key_type
,
size_type
]
_indices
vector
[
item_type
]
_items
unordered_map
[
key_type
,
size_type
]
_indices
mutable
atomic
[
int
]
_active_iterators
__init__
(
self
):
self
.
_active_iterators
.
store
(
0
)
V
__getitem__
(
self
,
const
key_type
key
)
except
~
const
:
it
=
self
.
_indices
.
find
(
key
)
it
=
self
.
_indices
.
const_
find
(
key
)
if
it
!=
self
.
_indices
.
end
():
return
self
.
_items
[
dereference
(
it
).
second
].
second
with
gil
:
...
...
@@ -183,10 +183,10 @@ cdef cypclass cypdict[K, V]:
raise
RuntimeError
(
"Modifying a dictionary with active iterators"
)
iterator
begin
(
self
)
const
:
return
iterator
(
self
.
_items
.
begin
(),
self
)
return
iterator
(
self
.
_items
.
const_
begin
(),
self
)
vector
[
item_type
].
iterator
end
(
self
)
const
:
return
self
.
_items
.
end
()
vector
[
item_type
].
const_
iterator
end
(
self
)
const
:
return
self
.
_items
.
const_
end
()
size_type
__len__
(
self
)
const
:
return
self
.
_items
.
size
()
...
...
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