You can if the type being swapped only contains a pointer towards the real data. This is the case in what I wanted to accomplish when I wrote this pull: http://stackoverflow.com/a/21104053/21501