Boost logo

Boost :

Subject: Re: [boost] rvalue ref best practices?
From: Howard Hinnant (howard.hinnant_at_[hidden])
Date: 2012-06-09 18:43:19


On Jun 9, 2012, at 6:17 PM, Daniel Larimer wrote:

> So, how much value is there to 'explicit copy only' types?

If you want to your type to be copyable, but you also want to be able to monitor where it is getting copied unnecessarily, one approach is to give it traditional copy syntax, but temporarily disable that copy when you want to review: inspect whatever doesn't compile to see if you really want to be making a copy there.

This technique is how I monitored the cost of std::list::size() in C++03: I just commented out std::list::size(), recompiled and observed what broke. Then fixed those places that were assuming that std::list::size() was O(1).

Howard


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk