You have shared a partial code. We do not have the headers RandomBoxes.h and Truckload.h, so one has to make assumptions here.
My assumption is that the type SharedBox is an alias to std::shared_ptr<Box>, where Box is a class that forms the load.
typedef std::shared_ptr<Box> SharedBox;
In the loop, getNextBox() returns a SharedBox and when there is no more Box in the list, it probably returns a null pointer. A null pointer interpreted as a logical expression is false. A non-null pointer interpreted as a logical expression is true.
SharedBox nextBox = load1.getNextBox();
means: repeat the loop as long as we have a nextBox.