Skip to content

Commit 5a3bbea

Browse files
Cosmetic
1 parent d4bd15f commit 5a3bbea

2 files changed

Lines changed: 17 additions & 18 deletions

File tree

examples/merge_channels.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ int main()
3939
const auto transformer = [&input_chan, &output_chan]() {
4040
std::transform(input_chan.begin(), input_chan.end(), msd::back_inserter(output_chan),
4141
[](int value) { return value * 2; });
42-
4342
output_chan.close();
4443
};
4544

tests/channel_test.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -324,27 +324,27 @@ TEST(ChannelTest, ReadWriteClose)
324324
EXPECT_EQ(nums, numbers);
325325
}
326326

327-
class MovableOnly {
327+
class movable_only {
328328
public:
329-
explicit MovableOnly(int value) : value_{value} {}
329+
explicit movable_only(int value) : value_{value} {}
330330

331-
MovableOnly() = default;
331+
movable_only() = default;
332332

333-
MovableOnly(const MovableOnly&)
333+
movable_only(const movable_only&)
334334
{
335-
std::cout << "Copy constructor should not be called for MovableOnly";
335+
std::cout << "Copy constructor should not be called";
336336
std::abort();
337337
}
338338

339-
MovableOnly(MovableOnly&& other) noexcept : value_{std::move(other.value_)} { other.value_ = 0; }
339+
movable_only(movable_only&& other) noexcept : value_{std::move(other.value_)} { other.value_ = 0; }
340340

341-
MovableOnly& operator=(const MovableOnly&)
341+
movable_only& operator=(const movable_only&)
342342
{
343-
std::cout << "Copy assignment should not be called for MovableOnly";
343+
std::cout << "Copy assignment should not be called";
344344
std::abort();
345345
}
346346

347-
MovableOnly& operator=(MovableOnly&& other) noexcept
347+
movable_only& operator=(movable_only&& other) noexcept
348348
{
349349
if (this != &other) {
350350
value_ = other.value_;
@@ -356,7 +356,7 @@ class MovableOnly {
356356

357357
int getValue() const { return value_; }
358358

359-
virtual ~MovableOnly() = default;
359+
virtual ~movable_only() = default;
360360

361361
private:
362362
int value_{0};
@@ -365,22 +365,22 @@ class MovableOnly {
365365
TEST(ChannelTest, Transform)
366366
{
367367
const int numbers = 100;
368-
const std::int64_t expected_sum = 5050 * 2;
369-
std::atomic<std::int64_t> sum{0};
370-
std::atomic<std::int64_t> nums{0};
368+
const int expected_sum = 5050 * 2;
369+
std::atomic<int> sum{0};
370+
std::atomic<int> nums{0};
371371

372-
msd::channel<MovableOnly> input_chan{30};
372+
msd::channel<movable_only> input_chan{30};
373373
msd::channel<int> output_chan{10};
374374

375375
// Send to channel input channel
376376
const auto writer = [&input_chan]() {
377377
for (int i = 1; i <= numbers; ++i) {
378-
input_chan.write(MovableOnly{i});
378+
input_chan.write(movable_only{i});
379379
}
380380
input_chan.close();
381381
};
382382

383-
// Transform input channel values from MovableOnly to int by multiplying by 2 and write to output channel
383+
// Transform input channel values from movable_only to int by multiplying by 2 and write to output channel
384384
const auto double_transformer = [&input_chan, &output_chan]() {
385385
std::transform(input_chan.begin(), input_chan.end(), msd::back_inserter(output_chan),
386386
[](auto&& value) { return value.getValue() * 2; });
@@ -427,7 +427,7 @@ TEST(ChannelTest, TransformAndAccumulate)
427427
// Filter: take even numbers
428428
const auto filter = [&input_chan, &output_chan]() {
429429
std::copy_if(input_chan.begin(), input_chan.end(), msd::back_inserter(output_chan),
430-
[](int v) { return v % 2 == 0; });
430+
[](int value) { return value % 2 == 0; });
431431
output_chan.close();
432432
};
433433

0 commit comments

Comments
 (0)