Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
ccf2420d
Commit
ccf2420d
authored
Aug 10, 2023
by
Paul
Browse files
Improve nested vectors
parent
3c1e10ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
test/msgpack.cpp
test/msgpack.cpp
+16
-1
No files found.
test/msgpack.cpp
View file @
ccf2420d
...
...
@@ -24,6 +24,7 @@
#include <migraphx/msgpack.hpp>
#include <migraphx/value.hpp>
#include <msgpack.hpp>
#include <algorithm>
#include <map>
#include "test.hpp"
...
...
@@ -37,13 +38,27 @@ auto msgpack_type(migraphx::rank<0>, T src)
}
template
<
class
T
>
auto
msgpack_type
(
migraphx
::
rank
<
1
>
,
const
T
&
src
)
->
decltype
(
src
.
empty
(),
std
::
vector
<
T
>
{})
auto
msgpack_type
(
migraphx
::
rank
<
1
>
,
const
T
&
src
)
->
decltype
(
src
.
empty
(),
std
::
vector
<
T
>
{
src
})
{
if
(
src
.
empty
())
return
{};
return
{
src
};
}
template
<
class
T
>
auto
msgpack_type
(
migraphx
::
rank
<
2
>
,
const
std
::
vector
<
T
>&
src
)
{
using
type
=
decltype
(
msgpack_type
(
migraphx
::
rank
<
2
>
{},
src
.
front
()));
using
result_type
=
std
::
vector
<
std
::
vector
<
type
>>
;
if
(
src
.
empty
())
return
result_type
{};
std
::
vector
<
type
>
result
;
std
::
transform
(
src
.
begin
(),
src
.
end
(),
std
::
back_inserter
(
result
),
[](
const
auto
&
x
)
{
return
msgpack_type
(
migraphx
::
rank
<
2
>
{},
x
);
});
return
result_type
{
result
};
}
template
<
class
T
>
std
::
vector
<
char
>
msgpack_buffer
(
const
T
&
src
)
{
...
...
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