There are Rev1, Rev2 and optimus switchable laptops.
We can ignore Rev 1 - they required a reboot to switch
This code is mostly towards the Rev 2 switchable, which switches the physical outputs between the chips under ACPI control.
Optimus is a different kettle of fish, and is also muddied by the fact that not all Optimus laptops have a Rev 2 compatability mode, most of them do, but I think there are some out there which don't have the physical mux anymore. So the Lenovo T410s has Optimus but it also has the ability to act like Rev 2, hence why this code was possible.
Optimus isn't "wired" its a pure sw solution built on a extra copy engine on the discrete GPU which talks for PCIE like anything normal would. No extra wires.