| 333 | } |
| 334 | |
| 335 | void Regexp::Swap(Regexp* that) { |
| 336 | // Regexp is not trivially copyable, so we cannot freely copy it with |
| 337 | // memmove(3), but swapping objects like so is safe for our purposes. |
| 338 | char tmp[sizeof *this]; |
| 339 | void* vthis = reinterpret_cast<void*>(this); |
| 340 | void* vthat = reinterpret_cast<void*>(that); |
| 341 | memmove(tmp, vthis, sizeof *this); |
| 342 | memmove(vthis, vthat, sizeof *this); |
| 343 | memmove(vthat, tmp, sizeof *this); |
| 344 | } |
| 345 | |
| 346 | // Tests equality of all top-level structure but not subregexps. |
| 347 | static bool TopEqual(Regexp* a, Regexp* b) { |