|
From: Luigi B. <lui...@gm...> - 2007-12-21 15:18:18
|
On Sat, 2007-12-15 at 18:09 -0500, Dominick Samperi wrote:
> I commented out the friend part like this:
> class Tracing : public Singleton<Tracing> {
> // friend class Singleton<Tracing>;
> private:
> Tracing();
>
> Can somebody comment on why the friend declaration is
> needed here? Doesn't this permit an interface to access the internals
> of the logic that it is supposed to encapsulate/hide via the
> "curiously recurring pattern"?
There's not much to be done about it. On the one hand, the Tracing
constructor must be made private if this is to be a Singleton class. On
the other hand, the instance() method of the Singleton class template
must call it to create the unique instance.
However, Tracing and Singleton<Tracing> are very much tied together, so
it's not much of an encapsulation breach. True, the above might allow
one to create two Tracing instances, but it wouldn't be easy and should
be done on purpose.
> An unrelated question: how is QuantLib-0.9.0.tar.gz made from the SVN
> repository?
By running 'make dist'.
> I am seeing different behavior if I use the preliminary tarball vs
> download from the 090 SVN branch.
Strange. Maybe there were other changes in the branch after the tarball
was created?
Luigi
--
Better to have an approximate answer to the right question than a
precise answer to the wrong question.
-- John Tukey as quoted by John Chambers
|