It looks like "the rule of three" allows you to abstract this check.