Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Olivier B.
pybind11
Commits
8456a4dc
Commit
8456a4dc
authored
Oct 13, 2015
by
Wenzel Jakob
Browse files
minor enum_ improvement (use __repr__ instead of __str__)
parent
bcd3182f
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/pybind/pybind.h
View file @
8456a4dc
...
...
@@ -813,7 +813,7 @@ public:
enum_
(
object
&
scope
,
const
char
*
name
,
const
char
*
doc
=
nullptr
)
:
class_
<
Type
>
(
scope
,
name
,
doc
),
m_parent
(
scope
)
{
auto
entries
=
new
std
::
unordered_map
<
int
,
const
char
*>
();
this
->
def
(
"__
st
r__"
,
[
name
,
entries
](
Type
value
)
->
std
::
string
{
this
->
def
(
"__
rep
r__"
,
[
name
,
entries
](
Type
value
)
->
std
::
string
{
auto
it
=
entries
->
find
((
int
)
value
);
return
std
::
string
(
name
)
+
"."
+
((
it
==
entries
->
end
())
?
std
::
string
(
"???"
)
...
...
Write
Preview
Supports
Markdown
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