This is achieved by overloading the operator|, although there is some special hackery to use static function objects to omit the constructor calls.
The first mayor library to use this syntax was Boost.Range and it is now being proposed as the syntax of standard ranges.