Ask HN: Object realocation with memmove

https://news.ycombinator.com/item?id=4471004
by dhucerbin • 14 years ago
1 1 14 years ago

Hi,

I stumbled upon folly [1], Facebook Open Source Library and in readme of vector [2] I found that it's possible to move objects with memmove. I imagine it's possible for int or char but how it's possible for complex objects? In [2] they even say that Only a tiny minority of objects are genuinely non-relocatable. Could someone provide an example of non-trivial memmoveable class?

[1] https://github.com/facebook/folly [2] https://github.com/facebook/folly/blob/master/folly/docs/FBVector.md#object-relocation

Related Stories

Loading related stories...

Source preview

news.ycombinator.com