On August 20, 2015 6:47:42 PM EDT, Andrey Semashev
On August 18, 2015 4:23:24 PM EDT, Andrey Semashev
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,
On 20.08.2015 22:04, Rob Stewart wrote: pass something like pre_load rather than true.
I'd prefer to allow the ability to fill the (possibly partially filled) 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. ___ Rob (Sent from my portable computation engine)