  const char16_t *castToChar16Ptr() const {
    assert(!isASCII() && "Cannot cast char pointer to char16 pointer");
    if (!isHandle_) {
      return static_cast<const char16_t *>(nonManagedStringPtr_) + startIndex_;
    }
    assert(isHandle_ && "StringView does not contain a valid string");
    return (*strPrim())->castToUTF16Pointer() + startIndex_;
  }
  const char16_t *castToChar16Ptr() const {
    assert(!isASCII() && "Cannot cast char pointer to char16 pointer");
    if (!isHandle_) {
      return static_cast<const char16_t *>(nonManagedStringPtr_) + startIndex_;
    }
    assert(isHandle_ && "StringView does not contain a valid string");
    return (*strPrim())->castToUTF16Pointer() + startIndex_;
  }