[Next] [Up] [Previous]
Next: Basic Collective Operations Up: Object Groups Previous: Indexing of Groups

Cloning of Groups

Distributed object groups can also be initialized (cloned) in parallel from existing groups.

GroupOf<FlockMember> group(...);


// complete clone
GroupOf<FlockMember> clone(group);


// selective clones
GroupOf<FlockMember> black(m2f(&Sheep::isBlack), group);
GroupOf<FlockMember> white(m2f(&Sheep::isWhite), group);

In this example clone is a complete copy of group. Additionally we can specify selective clones that only contain copies of those members that match the specified boolean predicate functor, thus black only contains copies of the black sheep in the group, while white contains only white sheep.