• Traister101
    link
    fedilink
    arrow-up
    2
    ·
    3 天前

    Depends on the object what happens when they are moved from. Some objects are put into a valid moved from state (usually depends on if doing so is free or required anyway. For example to satisfy the invariant of the moved to unique pointer the moved from pointer needs to be set to nullptr in order to prevent the moved tos unique pointer being deleted from underneath it)

      • Traister101
        link
        fedilink
        arrow-up
        1
        ·
        2 天前

        Douno off the top of my head. To take a wild guess they might just wrap a file handle and give it s nice api? If that’s what they do then moving from the file zeros out he handle for basically the same reason smart pointers set their internal pointer to nullptr, so they don’t delete it (or close the file in this case) underneath the new object.