Made some changes to get BOOST_SCOPED_ENUM to work right

I think this is working correctly, but now there are many errors from
result_of and the stl . . . :(