This one is different than others because it works with many different pistols, and I read that there's one for M-16 (probably M-4 actually) as well. It's usefulness as a main weapon is suspect, but it is terrific for safely peering around a corner without getting your face blown off.
The Germans did produce a weapon for use around corners and on top of buildings during WWII. I believe it was a modification of a StG-44, also known as the MP43 or MP44, with a bent barrel and a periscope-like sight. It wasn't widely used but apparently was effective.