Subject: Re: [boost] cache size runtime detection
From: Rob Stewart (rob.stewart_at_[hidden])
Date: 2015-08-20 22:09:53
On August 20, 2015 6:47:42 PM EDT, Andrey Semashev <andrey.semashev_at_[hidden]> wrote:
> On 20.08.2015 22:04, Rob Stewart wrote:
> > On August 18, 2015 4:23:24 PM EDT, Andrey Semashev
> <andrey.semashev_at_[hidden]> wrote:
> > This is the only thing which looks odd to me. It would be better to
> use an enumerated type, rather than bool here, or you could use the
> named constructor idiom (and make init() private).
> > That is, create a default constructed features for no caching, or
> use features::complete(), say, to get one pre-populated. Otherwise,
> pass something like pre_load rather than true.
> I'd prefer to allow the ability to fill the (possibly partially
> features object with an explicit function call.
complete() is, of course, a named function which populates the object, but it doesn't finish populating a partially loaded object. However, is there a real use case for lazily loading a subset and then loading everything? It seems unlikely to me. I'd expect usage to be either lazy access or preloading, not a combination.
> Also the static factory
> function makes an extra copy in the following pattern:
> void foo()
> static cpu::features f = cpu::features::complete();
RVO should mean no copies and, besides, that's something that would be done once.
(Sent from my portable computation engine)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk