Allow to specifically define output type for map and fold.

Thanks to Felics on stackoverflow for the help:
http://stackoverflow.com/a/25889439/369310
Generalized result type / container deduction into dedicated template and use apply to implement map.
Use improved integer sequence generation by Xeo.

See http://stackoverflow.com/a/17426611/369310