Yes, we have apartments, but this conversation is about townhomes and the different definitions of townhomes people use. Apartment buildings are absolutely the most efficient use of space, but the original poster on this thread was arguing for townhomes, and what is called a townhome in my area is just a single family home with shared walls with the neighbors to the left and right.
Hence roommates—townhomes (by the definition in my area) are not an efficient solution for homelessness unless you have many roommates.
I have a suspicion that what OP calls a townhome is something I would just call a small apartment building.