if I have a set for example, with the following content: 0,1,2,3,8,13,56,532,
how would I do a for(auto it = xxxxx; y ? z; ++it) from 3 to 532 to 0 to 3 ?
Like:
magic.start(3);
for(auto i: magic)
    std::cout << i << " ";
That would print:
3 8 13 56 532 0 1 2
Edit: Might anyone be interested in the end result (thanks for all the answers):
bool SpectateNextPlayer(int playerid)
{
    if (PlayerCurrentlySpectating[playerid] == INVALID_PLAYER_ID)
        return false;
    auto current = PlayersOnline.find(PlayerCurrentlySpectating[playerid]);
    for (auto it = current; it != PlayersOnline.end(); ++it)
        if (PlayerSpactatable(*it) && (*it) != PlayerCurrentlySpectating[playerid])
            if (PlayerSpectateOtherPlayer(playerid, *it))//check here if playerid != *it
                return true;
    for (auto it = PlayersOnline.begin(); it != current; ++it)
        if (PlayerSpactatable(*it) && (*it) != PlayerCurrentlySpectating[playerid])
            if (PlayerSpectateOtherPlayer(playerid, *it))
                return true;
    return !DisablePlayerSpectate(playerid);
}
bool SpectatePreviousPlayer(int playerid)
{   
    if (PlayerCurrentlySpectating[playerid] == INVALID_PLAYER_ID)
        return false;
    auto rcurrent = find(PlayersOnline.rbegin(), PlayersOnline.rend(), PlayerCurrentlySpectating[playerid]);
    for (auto it = rcurrent; it != PlayersOnline.rend(); ++it)
        if (PlayerSpactatable(*it) && (*it) != PlayerCurrentlySpectating[playerid])
            if (PlayerSpectateOtherPlayer(playerid, *it))
                return true;
    for (auto it = PlayersOnline.rbegin(); it != rcurrent; ++it)
        if (PlayerSpactatable(*it) && (*it) != PlayerCurrentlySpectating[playerid])
            if (PlayerSpectateOtherPlayer(playerid, *it))
                return true;
    return !DisablePlayerSpectate(playerid);
}
 
     
     
     
    