Skip to content

Commit

Permalink
Replaced generator deleted copy operations with static_assert to impr…
Browse files Browse the repository at this point in the history
…ove compiler error messages
  • Loading branch information
mikucionisaau committed May 29, 2024
1 parent eb52dfb commit 12f738c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/coro/generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ class generator : public std::ranges::view_base

generator() noexcept : m_coroutine(nullptr) {}

generator(const generator&) = delete;
generator(const generator&) { static_assert(false, "copying is not supported"); }
generator(generator&& other) noexcept : m_coroutine(other.m_coroutine) { other.m_coroutine = nullptr; }

auto operator=(const generator&) = delete;
auto operator=(const generator&) { static_assert(false, "copying is not supported"); }
auto operator=(generator&& other) noexcept -> generator&
{
m_coroutine = other.m_coroutine;
Expand Down

0 comments on commit 12f738c

Please sign in to comment.