Skip to content

Commit 323fcb2

Browse files
Transform to different type
1 parent d100e93 commit 323fcb2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tests/channel_test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ TEST(ChannelTest, Transform)
367367
std::atomic<std::int64_t> nums{0};
368368

369369
msd::channel<MovableOnly> input_chan{30};
370-
msd::channel<MovableOnly> output_chan{10};
370+
msd::channel<int> output_chan{10};
371371

372372
// Send to channel input channel
373373
const auto writer = [&input_chan]() {
@@ -377,17 +377,17 @@ TEST(ChannelTest, Transform)
377377
input_chan.close();
378378
};
379379

380-
// Transform input channel values by multiplying by 2 and write to output channel
380+
// Transform input channel values from MovableOnly to int by multiplying by 2 and write to output channel
381381
const auto double_transformer = [&input_chan, &output_chan]() {
382382
std::transform(input_chan.begin(), input_chan.end(), msd::back_inserter(output_chan),
383-
[](auto&& value) { return MovableOnly{value.getValue() * 2}; });
383+
[](auto&& value) -> int { return value.getValue() * 2; });
384384
output_chan.close();
385385
};
386386

387387
// Read from output channel
388388
const auto reader = [&output_chan, &sum, &nums]() {
389389
for (auto&& out : output_chan) { // blocking until channel is drained (closed and empty)
390-
sum += out.getValue();
390+
sum += out;
391391
++nums;
392392
}
393393
};

0 commit comments

Comments
 (0)