| 685 | } |
| 686 | |
| 687 | void swap(ProducerToken& other) MOODYCAMEL_NOEXCEPT |
| 688 | { |
| 689 | std::swap(producer, other.producer); |
| 690 | if (producer != nullptr) { |
| 691 | producer->token = this; |
| 692 | } |
| 693 | if (other.producer != nullptr) { |
| 694 | other.producer->token = &other; |
| 695 | } |
| 696 | } |
| 697 | |
| 698 | // A token is always valid unless: |
| 699 | // 1) Memory allocation failed during construction |