second is better: * No chance of name collision (std::distance, I looking at you) * Everybody who will read your code will know that you are referring to standard library, not self-written one.
Compare:
1 2 3
#include "everything_needed.h"
usingnamespace std;
x = distance(start, finish);
and
1 2 3
#include "everything_needed.h"
x = distance(start, finish);
y = std::distance(x.begin(),x.end());
In first case you cannot be sure that it is or isn't a standard function. Worse: if you using self-written function and will sometime add <algorithm> header, you will have to deal with name collision, which is nasty.