Look at the context of the code you're reading - it's taken from a standard library implementation and the authors wanted to make sure their code works with a wide variety of compilers. So for really old festering piles of bits that don't understand namespaces they can just do something like:
#define __STD
and hey presto it'll compile.
So why do they use double underscores? Well if you read the C++ standard you'll see that identifiers with two underscores ANYWHERE in the name are reserved. That means compiler vendors only. Using double underscores is a great way of a compiler vendor keeping their identifiers out of the collision scope of user programs.
Identifiers starting with single underscores are reserved for library vendors for the same reasons.
Cheers,
Ash