Refactor any to not use any const_casts

Consider this a followup to #115. There's no need to use const_cast,
since it's very easy to make it work in a const-correct manner.