编译时错误之 error C2338: tuple_element index out of bounds
生活随笔
收集整理的這篇文章主要介紹了
编译时错误之 error C2338: tuple_element index out of bounds
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
part 1?
編譯器 vs2015 VC++。
完整的錯(cuò)誤信息粘貼如下:
d:\program files (x86)\microsoft visual studio 14.0\vc\include\utility(361): error C2338: tuple_element index out of bounds在百度上找了一下,沒(méi)有中文版解釋。我覺(jué)得今后把C++編譯時(shí)遇到的錯(cuò)誤及解決方法記錄下來(lái)會(huì)很有裨益。
?
part 2 正文
錯(cuò)誤的代碼:
auto it1 = find_if(numbers.cbegin(), numbers.cend(), bind(check_size, "feng", placeholders::_2));錯(cuò)誤原因:
auto newCallable = bind(check_size, "feng", placeholders::_2);? 錯(cuò)誤的使用了 placeholdesr::_2 ,其含義是 newCallable 的第二個(gè)參數(shù),是暴露給算法的第二個(gè)參數(shù)。要知道,newCallable 只有一個(gè)參數(shù)是暴漏的算法的,還沒(méi)有第一個(gè)呢,直接就有了第二個(gè),編譯時(shí)錯(cuò)誤妥妥的!
如何改正:
auto it1 = find_if(numbers.cbegin(), numbers.cend(), bind(check_size, "feng", placeholders::_1));? 把?placeholdesr::_2 改成?placeholdesr::_1。
?
(全文完)
轉(zhuǎn)載于:https://www.cnblogs.com/fengyubo/p/4866623.html
總結(jié)
以上是生活随笔為你收集整理的编译时错误之 error C2338: tuple_element index out of bounds的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 药品广告台词28句
- 下一篇: EBS请求查找运行详细信息