freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange initialization code for Particle layouts


From: Richard Guenther
Subject: Strange initialization code for Particle layouts
Date: Sun, 11 Jul 2004 17:49:59 +0200
User-agent: Mozilla Thunderbird 0.6 (X11/20040605)

Hi!

There is some strange code in the particle layout initializations:

template <class M, class FL>
class SpatialLayout
  : public PatchSwapLayout< SpatialLayout<M,FL> >
{
public:
[...]
  // Default constructor.  Initialize with assignment operator.

  SpatialLayout()
    : Base_t(*this)
    {}


what is this idiom Base(*this) supposed to do!? PatchSwapLayout doesn't define an assignment operator, so the comment doesn't make any sense. It looks like this initialization provokes undefined behavior and such can be dropped in favor of default-construction (which the PatchSwapLayout doesn't define)? I'm confused, so maybe someone could shed a light on me here. I guess the layout_m member of PatchSwapLayout could be implemented as static_cast<Layout_t>(*this) rather than playing this "trick"?

Thanks,
Richard.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]