Remove lots of unnecessary code duplication using boost::enable_if magic.