Function next


#include <include/internal/catch_generators_generic.hpp>

bool next() override


No description yet.


Lines 119-141 in include/internal/catch_generators_generic.hpp.

bool next() override {
    // There are 2 basic cases:
    // 1) We are still reading the generator
    // 2) We are reading our own cache
    // In the first case, we need to poke the underlying generator.
    // If it happily moves, we are left in that state, otherwise it is time to start reading from our cache
    if (m_current_repeat == 0) {
        const auto success =;
        if (!success) {
        return m_current_repeat < m_target_repeats;
    // In the second case, we need to move indices forward and check that we haven't run up against the end
    if (m_repeat_index == m_returned.size()) {
        m_repeat_index = 0;
    return m_current_repeat < m_target_repeats;

Add Discussion as Guest

Log in