Le 22/02/2017 à 18:03, Jean-Marc Lasgouttes a écrit :
Le 21/02/2017 à 20:13, Guillaume Munch a écrit :
BTW, why don't you use Cache::contains in getLayout like you do for
other cache uses?
This is explained in the documentation of Cache::object. It is enough to
check for a null pointer in that case.
It would be nice to hide these subtleties in the Cache implementation,
if possible.
Hi Jean-Marc,
I am not sure what you mean with "hide these subtleties". The
specification is simple: if the key does not exist in the cache, you get
the default object. I thought about using boost::optional at first but
for the main use I had in mind (shared_ptr) I found that the code would
be heavier (you end up having to dereference twice) for little clarity gain.
Guillaume