Anonymous objects

The objects I don't even care to give a name to

Often used with interface objects (which put a face on data)

Listen listen_socket(SocketAddr(IPaddress(),Listen_port));

used in a magical conversion from a Cstr to a Pstr

FilterIt(image). conv(conv_kernel(1,1,1,CommonDenom(3))). clip_to_intensity_range();
void VenusDialog::stop_flight(void)
  is_flying = FALSE;
  const int time_elapsed = TickCount() - time_started;	// in Ticks
   time_elapsed == 0 ? 0 : (60*frame_counter)/time_elapsed );


A more advanced example of anonymous objects, which actually do a byte-compilation.

Not only we don't allocate the thing on heap, we don't even assign it a name (nipping possible name conflicts in the bud). No garbage (object garbage/name garbage).

In the FilterIt example: conv_kernel and CommonDenom are classes (not functions). So is FilterIt. And it's all one single statement.

Next | Table of contents