Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
eigenpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
eigenpy
Commits
3d7f588e
Verified
Commit
3d7f588e
authored
1 year ago
by
Justin Carpentier
Browse files
Options
Downloads
Patches
Plain Diff
core: add converter to Python for std::pair
parent
a0fa42db
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#34137
passed with warnings
1 year ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/eigenpy/std-pair.hpp
+3
-3
3 additions, 3 deletions
include/eigenpy/std-pair.hpp
unittest/python/test_std_pair.py
+2
-1
2 additions, 1 deletion
unittest/python/test_std_pair.py
unittest/std_pair.cpp
+6
-0
6 additions, 0 deletions
unittest/std_pair.cpp
with
11 additions
and
4 deletions
include/eigenpy/std-pair.hpp
+
3
−
3
View file @
3d7f588e
...
...
@@ -54,13 +54,13 @@ struct StdPairConverter {
static
void
registration
()
{
boost
::
python
::
converter
::
registry
::
push_back
(
&
convertible
,
&
construct
,
boost
::
python
::
type_id
<
pair_type
>
()
&
convertible
,
&
construct
,
boost
::
python
::
type_id
<
pair_type
>
()
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
,
,
get_pytype
#endif
);
boost
::
python
::
to_python_converter
<
pair_type
,
StdPairConverter
,
true
>
();
}
};
...
...
This diff is collapsed.
Click to expand it.
unittest/python/test_std_pair.py
+
2
−
1
View file @
3d7f588e
from
std_pair
import
std_pair_to_tuple
from
std_pair
import
std_pair_to_tuple
,
copy
t
=
(
1
,
2.0
)
assert
std_pair_to_tuple
(
t
)
==
t
assert
copy
(
t
)
==
t
This diff is collapsed.
Click to expand it.
unittest/std_pair.cpp
+
6
−
0
View file @
3d7f588e
...
...
@@ -12,6 +12,11 @@ bp::tuple std_pair_to_tuple(const std::pair<T1, T2>& pair) {
return
bp
::
make_tuple
(
pair
.
first
,
pair
.
second
);
}
template
<
typename
T1
,
typename
T2
>
std
::
pair
<
T1
,
T2
>
copy
(
const
std
::
pair
<
T1
,
T2
>&
pair
)
{
return
pair
;
}
BOOST_PYTHON_MODULE
(
std_pair
)
{
using
namespace
eigenpy
;
...
...
@@ -21,4 +26,5 @@ BOOST_PYTHON_MODULE(std_pair) {
StdPairConverter
<
PairType
>::
registration
();
bp
::
def
(
"std_pair_to_tuple"
,
std_pair_to_tuple
<
int
,
double
>
);
bp
::
def
(
"copy"
,
copy
<
int
,
double
>
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment