Work around an incorrect assertion in older versions of boost. Closes #1702.