template<class T>
class BinTree {
 public: 
    typedef  ObjectPtr<T>* iterator;
    BinTree() { slot = 0; }
    void join(ObjectPtr<T> obj)
   {
      ObjectPtr<T> NIL;
      if (child[slot] == NIL)
          child[slot] = obj;
      else
          child[slot]->apply( m2f(&join,obj) );
      slot = (slot+1) % 2;
    }
    iterator begin() { return &child[0]; }
    iterator end()   { return &child[2]; }
    int size() const { return 2; }
 protected:
    ObjectPtr<T> child[2];
    int slot;
};
The iterator effectively determines the order in which the 
specified functor is passed to the group members
and must have the -> operator defined, in the case the iterator
is not a C++ pointer type. 
Most of TACO's topology classes also provide a join() method to add new members dynamically to the group. This is also a prerequisite to apply the GroupOf and CollectionOf classes to create entire collections with an a priori known size. Note, that the code to build the distributed tree recursively has nearly the same structure as the code for a local tree and distributed programs can be written with the same ease as local programs.