在C ++中使用元组作为元素访问元组

时间:2019-02-13 10:34:08

标签: c++

如何使用get访问以元组为元素的元组?

vector<tuple<string, int, vector<tuple<string, int, string>>>> setOfWord

如果我使用带有对作为元素的元组,

vector <tuple<string, int, vector<pair<string, string>>>> setOfWord

我可以使用

访问元素
if( wordVector ==  (get<2>(setOfWord[i]))[j].second)

但是如果我使用元组而不是对,如何检索内部元素呢?

谢谢

1 个答案:

答案 0 :(得分:0)

尝试这样

; signed 16b compare RP (HL/DE/BC) vs nonzero constant #XY
; subroutine, returns CF=1 if RP < #XY, modifies A
    mov     a,R
    xri     0x80    ; convert 8000..7FFF into 0000..FFFF
    cpi     #X^0x80 ; "X" is xor-ed with 0x80 too to have it in 0000..FFFF range
    rnz             ; if ZF=0, then CF=1 is (RP < XY) and CF=0 is (RP > XY)
    ; R == X, the low 8b P vs Y will decide
    mov     a,P
    cpi     #Y      ; CF=1 if (RP < XY)
    ret             ; 10B for particular #XY constant and RP

; inlined form
    mov     a,R
    xri     0x80    ; convert 8000..7FFF into 0000..FFFF
    cpi     #X^0x80 ; "X" is xor-ed with 0x80 too to have it in 0000..FFFF range
    jnz     HiByteWasDecisive   ; if ZF=0, then CF is set correctly, done
    mov     a,P     ; R == #X, the low 8b P vs #Y will decide final CF
    cpi     #Y      ; CF=1 if (RP < #XY)
:HiByteWasDecisive
    ; CF=1 is (RP < #XY) and CF=0 is (RP >= #XY)
    ...