Boost logo

Boost Users :

From: Zeljko Vrba (zvrba_at_[hidden])
Date: 2008-06-05 06:58:18

I have a following situation:

class X {
  type1 v1;
  type2 v2;
  typen vn;
  other_var ...
  X() : v1(this), v2(this), .., vn(this), other_var(1, 2, 3)
  { }

I'm looking for suggestions on how to automatically initialize
variables with "this" being passed as the only argument
to their constructor. In the ideal case, the programmer should
not need to specify any constructor calls for, so that
the end result looks something like:

class X {
  type1 v1; ... typen vn;
  X() : other_var(1, 2, 3)
    // some "magic" arranges that v1(this) .. vn(this) is called


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at