Skip to content

Commit a3d9034

Browse files
author
MarcDirven
committed
Example fixes. Removal of custom_iterator. Add iterator to detail namespace & rename
1 parent ab654d1 commit a3d9034

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+56
-371
lines changed

examples/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ set(examples
1919
chunks
2020
common
2121
concatenate
22-
custom_iterator
2322
drop_while
2423
drop
2524
enumerate
@@ -60,4 +59,5 @@ set(examples
6059
foreach(name IN LISTS examples)
6160
add_executable(example_${name} ${name}.cpp)
6261
target_link_libraries(example_${name} PRIVATE cpp-lazy::cpp-lazy)
62+
target_compile_options(example_${name} PRIVATE -ftemplate-backtrace-limit=0)
6363
endforeach()

examples/chunk_if.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@ int main() {
4242
// hello world
4343
// this is a message
4444

45-
auto chunked_s = s | lz::s_chunk_if([](const char c) { return c == ';'; });
46-
for (auto chunk : chunked_s) {
47-
std::cout << chunk << '\n';
48-
// or use fmt::print("{}\n", chunk);
49-
}
50-
// Output:
51-
// hello world
52-
// this is a message
53-
5445
// with custom types
5546
auto chunked_vector = s | lz::t_chunk_if<std::vector<char>>([](const char c) { return c == ';'; });
5647
for (auto vec_chunk : chunked_vector) {
@@ -94,14 +85,6 @@ int main() {
9485
// hello world
9586
// this is a message
9687

97-
lz::for_each(s | lz::s_chunk_if([](const char c) { return c == ';'; }), [](const std::string& chunk) {
98-
std::cout << chunk << '\n';
99-
// or use fmt::print("{}\n", chunk);
100-
});
101-
// Output:
102-
// hello world
103-
// this is a message
104-
10588
#ifdef LZ_HAS_CXX_11
10689

10790
// with custom types

examples/concatenate.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include <Lz/concatenate.hpp>
22
#include <Lz/range.hpp>
3+
#include <array>
34
#include <iostream>
45
#include <vector>
56

6-
77
int main() {
88
std::array<int, 4> a{1, 2, 3, 4};
99
std::array<int, 4> b{5, 6, 7, 8};
@@ -46,4 +46,5 @@ int main() {
4646
}
4747
// Output: 21 22 23 24 0 1 2 3 4
4848
std::cout << '\n';
49+
// TODO add reference wrapper
4950
}

examples/custom_iterator.cpp

Lines changed: 0 additions & 273 deletions
This file was deleted.

examples/iter_tools.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,10 @@ int main() {
216216
auto to_pad = 3;
217217
auto padded_ref = pad_numbers | lz::pad(std::ref(to_pad), 2); // {1, 2, 3, 3, 3} by reference
218218
#ifdef LZ_HAS_CXX_11
219-
lz::for_each(padded_ref, [](int& p) { std::cout << p << ' '; });
219+
lz::for_each(padded_ref, [](std::reference_wrapper<int> p) { std::cout << p << ' '; });
220220
// 1 2 3 3 3
221221
#else
222-
for (auto& p : padded_ref) {
222+
for (std::reference_wrapper<int> p : padded_ref) {
223223
std::cout << p << ' ';
224224
}
225225
#endif

examples/split.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <Lz/split.hpp>
44
#include <iostream>
55
#include <vector>
6+
#include <array>
67

78
int main() {
89
// With split you can split an iterable on a delimiter or an iterable delimiter (multiple delimiters)

0 commit comments

Comments
 (0)