17.3.2 Add

The add method requires a reference to a block as an argument. Its function is to add all squares in that block to the container. Therefore, we provided a method in the class  eeClassblock to gain access to all the squares of that block. The class squares has a method create with arguments for a position and a block type. With that information, you write this method like this:

 
void add(C block & b) 
{ 
   C Mems<square> & squares = b.getSquares(); 
   REPA(squares) 
5 { 
      list.New().create(squares[i].getPos(), b.getType()); 
 } 
}  

Now that you’ve finished this feature, you can already try out the init, add and draw function in your test program.