Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jan Koniarik
emlabcpp
Commits
ad07d80e
Commit
ad07d80e
authored
Apr 20, 2021
by
Jan Koniarik
Browse files
fixed concept usage in zip and added zip tests
parent
2ad186e0
Pipeline
#80780
passed with stage
in 33 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
include/emlabcpp/zip.h
View file @
ad07d80e
...
...
@@ -105,7 +105,7 @@ constexpr bool operator!=(const zip_iterator<Iterators...> &lh,
/// ranges. If the size differs, increments of begin iterator will never be same
/// as end iterator.
//
template
<
typename
...
Ts
,
std
::
enable_if_t
<
std
::
conjunction_v
<
is_container
<
Ts
>...
>>
*
=
nullptr
>
template
<
range_container
...
Ts
>
inline
auto
zip
(
Ts
&&
...
cont
)
{
return
view
(
zip_iterator
(
std
::
begin
(
cont
)...),
zip_iterator
(
std
::
end
(
cont
)...));
}
...
...
tests/CMakeLists.txt
View file @
ad07d80e
...
...
@@ -47,5 +47,6 @@ add_emlabcpp_test(numeric_iterator_test)
add_emlabcpp_test
(
access_iterator_test
)
add_emlabcpp_test
(
either_test
)
add_emlabcpp_test
(
physical_quantity_test
)
add_emlabcpp_test
(
zip_test
)
add_emlabcpp_test
(
static_vector_test
)
add_emlabcpp_test
(
pid_test
)
tests/zip_test.cpp
0 → 100644
View file @
ad07d80e
#include "emlabcpp/zip.h"
#include <gtest/gtest.h>
using
namespace
emlabcpp
;
TEST
(
zip
,
simple
)
{
std
::
vector
<
int
>
data
=
{
1
,
2
,
3
,
4
,
5
};
for
(
auto
[
lh
,
rh
]
:
zip
(
data
,
data
))
{
EXPECT_EQ
(
lh
,
rh
);
}
}
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