Error[8]: Undefined offset: 11, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述在 Swift 3中,我想知道为什么我能够使用半开放范围运算符.<在 Data.subdata(in:)但不是封闭范围的 *** 作符…. 我到处搜索,但无法理解为什么它给了我这个错误: 没有’…’候选人产生预期的上下文结果类型 ‘Range'(又名’Range’) 这是一个有效的例子和一个没有的例子: import Foundationlet x = Data(bytes: [0x0, 0x1]) 在 Swift 3中,我想知道为什么我能够使用半开放范围运算符.<在 Data.subdata(in:)但不是封闭范围的 *** 作符….

我到处搜索,但无法理解为什么它给了我这个错误:
没有’…’候选人产生预期的上下文结果类型
‘Range'(又名’Range’)

这是一个有效的例子和一个没有的例子:

import Foundationlet x = Data(bytes: [0x0,0x1])let y : UInt8 = x.subdata(in: 0..<2).withUnsafeBytes{..<.pointee}let z : UInt8 = x.subdata(in: 0...1).withUnsafeBytes{Range.pointee} // This fails

谢谢!

> CountableRange是半开 range operator,它可以创建 Strideable...(取决于Bound是否是 ClosedRange与整数步幅).创建的范围包括下限,但不包括上限.
> CountableClosedRange是闭区域运算符,可以创建 subdata(in:)
extension Data {    func subdata(in range: ClosedRange<Index>) -> Data {        return subdata(in: range.lowerBound ..< range.upperBound + 1)    }}
(与上述相同的要求).创建的范围包括上限和下限.

因此,当

let x = Data(bytes: [0x0,0x1])let z : UInt8 = x.subdata(in: 0...1).withUnsafeBytes {[+++].pointee}
期望Range< Int>时,您不能使用闭区域运算符…以构造参数 – 您必须使用半开范围运算符.

但是,扩展数据并添加一个接受ClosedRange< Int>的重载将是微不足道的,这将允许您使用闭区域运算符.

[+++] [+++] 总结

以上是内存溢出为你收集整理的swift – 在Data.subdata中使用Range运算符全部内容,希望文章能够帮你解决swift – 在Data.subdata中使用Range运算符所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 166, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
Error[8]: Undefined offset: 12, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述在 Swift 3中,我想知道为什么我能够使用半开放范围运算符.<在 Data.subdata(in:)但不是封闭范围的 *** 作符…. 我到处搜索,但无法理解为什么它给了我这个错误: 没有’…’候选人产生预期的上下文结果类型 ‘Range'(又名’Range’) 这是一个有效的例子和一个没有的例子: import Foundationlet x = Data(bytes: [0x0, 0x1]) 在 Swift 3中,我想知道为什么我能够使用半开放范围运算符.<在 Data.subdata(in:)但不是封闭范围的 *** 作符….

我到处搜索,但无法理解为什么它给了我这个错误:
没有’…’候选人产生预期的上下文结果类型
‘Range'(又名’Range’)

这是一个有效的例子和一个没有的例子:

import Foundationlet x = Data(bytes: [0x0,0x1])let y : UInt8 = x.subdata(in: 0..<2).withUnsafeBytes{..<.pointee}let z : UInt8 = x.subdata(in: 0...1).withUnsafeBytes{Range.pointee} // This fails

谢谢!

> CountableRange是半开 range operator,它可以创建 Strideable...(取决于Bound是否是 ClosedRange与整数步幅).创建的范围包括下限,但不包括上限.
> CountableClosedRange是闭区域运算符,可以创建 subdata(in:)
extension Data {    func subdata(in range: ClosedRange<Index>) -> Data {        return subdata(in: range.lowerBound ..< range.upperBound + 1)    }}
(与上述相同的要求).创建的范围包括上限和下限.

因此,当

let x = Data(bytes: [0x0,0x1])let z : UInt8 = x.subdata(in: 0...1).withUnsafeBytes {.pointee}
期望Range< Int>时,您不能使用闭区域运算符…以构造参数 – 您必须使用半开范围运算符.

但是,扩展数据并添加一个接受ClosedRange< Int>的重载将是微不足道的,这将允许您使用闭区域运算符.

[+++] [+++] 总结

以上是内存溢出为你收集整理的swift – 在Data.subdata中使用Range运算符全部内容,希望文章能够帮你解决swift – 在Data.subdata中使用Range运算符所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 166, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
Error[8]: Undefined offset: 13, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述在 Swift 3中,我想知道为什么我能够使用半开放范围运算符.<在 Data.subdata(in:)但不是封闭范围的 *** 作符…. 我到处搜索,但无法理解为什么它给了我这个错误: 没有’…’候选人产生预期的上下文结果类型 ‘Range'(又名’Range’) 这是一个有效的例子和一个没有的例子: import Foundationlet x = Data(bytes: [0x0, 0x1]) 在 Swift 3中,我想知道为什么我能够使用半开放范围运算符.<在 Data.subdata(in:)但不是封闭范围的 *** 作符….

我到处搜索,但无法理解为什么它给了我这个错误:
没有’…’候选人产生预期的上下文结果类型
‘Range'(又名’Range’)

这是一个有效的例子和一个没有的例子:

import Foundationlet x = Data(bytes: [0x0,0x1])let y : UInt8 = x.subdata(in: 0..<2).withUnsafeBytes{..<.pointee}let z : UInt8 = x.subdata(in: 0...1).withUnsafeBytes{Range.pointee} // This fails

谢谢!

> CountableRange是半开 range operator,它可以创建 Strideable...(取决于Bound是否是 ClosedRange与整数步幅).创建的范围包括下限,但不包括上限.
> CountableClosedRange是闭区域运算符,可以创建 subdata(in:)
extension Data {    func subdata(in range: ClosedRange<Index>) -> Data {        return subdata(in: range.lowerBound ..< range.upperBound + 1)    }}
(与上述相同的要求).创建的范围包括上限和下限.

因此,当

let x = Data(bytes: [0x0,0x1])let z : UInt8 = x.subdata(in: 0...1).withUnsafeBytes {.pointee}
期望Range< Int>时,您不能使用闭区域运算符…以构造参数 – 您必须使用半开范围运算符.

但是,扩展数据并添加一个接受ClosedRange< Int>的重载将是微不足道的,这将允许您使用闭区域运算符.

[+++] 总结

以上是内存溢出为你收集整理的swift – 在Data.subdata中使用Range运算符全部内容,希望文章能够帮你解决swift – 在Data.subdata中使用Range运算符所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 166, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
swift – 在Data.subdata中使用Range运算符_app_内存溢出

swift – 在Data.subdata中使用Range运算符

swift – 在Data.subdata中使用Range运算符,第1张

概述在 Swift 3中,我想知道为什么我能够使用半开放范围运算符.<在 Data.subdata(in:)但不是封闭范围的 *** 作符…. 我到处搜索,但无法理解为什么它给了我这个错误: 没有’…’候选人产生预期的上下文结果类型 ‘Range'(又名’Range’) 这是一个有效的例子和一个没有的例子: import Foundationlet x = Data(bytes: [0x0, 0x1]) 在 Swift 3中,我想知道为什么我能够使用半开放范围运算符.<在 Data.subdata(in:)但不是封闭范围的 *** 作符….

我到处搜索,但无法理解为什么它给了我这个错误:
没有’…’候选人产生预期的上下文结果类型
‘Range'(又名’Range’)

这是一个有效的例子和一个没有的例子:

import Foundationlet x = Data(bytes: [0x0,0x1])let y : UInt8 = x.subdata(in: 0..<2).withUnsafeBytes{..<.pointee}let z : UInt8 = x.subdata(in: 0...1).withUnsafeBytes{Range.pointee} // This fails

谢谢!

> CountableRange是半开 range operator,它可以创建 Strideable...(取决于Bound是否是 ClosedRange与整数步幅).创建的范围包括下限,但不包括上限.
> CountableClosedRange是闭区域运算符,可以创建 subdata(in:)
extension Data {    func subdata(in range: ClosedRange<Index>) -> Data {        return subdata(in: range.lowerBound ..< range.upperBound + 1)    }}
(与上述相同的要求).创建的范围包括上限和下限.

因此,当

let x = Data(bytes: [0x0,0x1])let z : UInt8 = x.subdata(in: 0...1).withUnsafeBytes {.pointee}
期望Range< Int>时,您不能使用闭区域运算符…以构造参数 – 您必须使用半开范围运算符.

但是,扩展数据并添加一个接受ClosedRange< Int>的重载将是微不足道的,这将允许您使用闭区域运算符.

总结

以上是内存溢出为你收集整理的swift – 在Data.subdata中使用Range运算符全部内容,希望文章能够帮你解决swift – 在Data.subdata中使用Range运算符所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1029691.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存