No need to declare 'r' early, just say

const bool r = cursor->more()