We have a little canal boat whose rear (only) cabin currently has a fairly old-fashioned mattress. It's either a small double or a large single (though as it's in mainland Europe those designations may be misleading).
We'd like to make it a little wider, there is some space to extend the underlying support, but it's not a perfect rectangle. At the 'foot' end it's 135cm wide whereas at the 'head' end it's only 125cm wide.
A 'standard' double mattress is 135cm x 190cm, if we got a 'memory foam' mattress would it 'learn' to be only 125cm wide at one end?
One can get custom sized mattresses for boats but they are always expensive.