Commit ad07d80e authored by Jan Koniarik's avatar Jan Koniarik
Browse files

fixed concept usage in zip and added zip tests

parent 2ad186e0
Pipeline #80780 passed with stage
in 33 seconds
......@@ -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)...));
}
......
......@@ -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)
#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);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment