Logo Search packages:      
Sourcecode: kbruch version File versions  Download package

unsigned int primenumber::get_next (  )

returns the next prime number

Definition at line 83 of file primenumber.cpp.

References current_pos, find_next(), get_last(), move_last(), and prim_vector.

Referenced by isPrimeNumber(), and ratio::reduce().

{
    /* if we do not know the next number, we have to find it first */
    if (current_pos == prim_vector.end() ||
            ++current_pos == prim_vector.end()) {
        /* we do not know the next prime number, so we have to find it */
        find_next();
        move_last();
        return get_last(); /* return it */
    } else {
        /* we know the next prime number, set the pointer on it */
        return *current_pos; /* return it */
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index