Commit cf532f8
authored
Explicitly delete copy constructor and assignment in Timer (#665)
## Summary
`Timer::~Timer()` calls `Report()`, logging the elapsed time to a tracer
or stdout. With no explicit copy policy, a copied `Timer` would produce
a second `Report()` on its own destruction — silently logging a
duplicate timing entry for the same measured interval.
`tag_` and `t_` are non-owning pointers (no `delete` in the destructor),
so there is no memory-safety risk. The issue is purely semantic, but it
is a real hazard for callers who pass or store `Timer` by value.
Explicitly `= delete` the copy constructor and copy assignment to make
the non-copyable intent clear.
## Test plan
- [x] `basic/gpu` builds cleanly in debug mode
- [x] Full debug build passes with no errors1 parent 6c7a332 commit cf532f8
1 file changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
| |||
0 commit comments