本文介绍了需要帮助将C ++转换为javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在为我的客户构建一个javascript指标,他们给了我旧系统的C ++代码。我之前从未做过C ++程序。下面是C ++代码的一部分。我想知道的是

Hello all,

I'm constructing a javascript indicator for my client and they gave me below C++ code from their old system. I have never done C++ program before. Below is the part of the C++ code. What I want to know is in the line

if (it3 != d1Swing.end() && it3->x == h[i].x) --(it1 = it2 = it3);

- (it1 = it2 = it3)是什么意思?它在javascript中会是什么样子?



what is the meaning of --(it1 = it2 = it3)? What will it looks like in javascript?

vector<PTPoint::PTIndexPoint> dnSwing;
list<PTPoint::PTIndexPoint> hq, lq;
vector<PTPoint::PTIndexPoint>::iterator it1 = d1Swing.begin(), it2 = d1Swing.begin(), it3 = ++d1Swing.begin();
//
// more code here
//
for (int i = 0; i < period; ++i)
{
    while (!hq.empty() && hq.back().y < h[i].y) hq.pop_back();
    hq.push_back(h[i]);
    while (!lq.empty() && lq.back().y > l[i].y) lq.pop_back();
    lq.push_back(l[i]);
    if (it3 != d1Swing.end() && it3->x == h[i].x) --(it1 = it2 = it3);
    //
    // more code here
    //
}
//
// more code here
//
p->swap(dnSwing);





先谢谢。

tslin



我尝试了什么:



我用谷歌搜索了很长时间但是搜索包括特殊字符和那些字符在大多数语言中使用。



Thanks in advanced.
tslin

What I have tried:

I've googled for a long time but search include special characters and those characters were used in most of the languages.

推荐答案

引用:

什么是 - (it1 = it2 = it3)的含义?它在javascript中会是什么样子?

what is the meaning of --(it1 = it2 = it3)? What will it looks like in javascript?




  1. it3 分配给 it2 .
  2. 分配 it2 it1
  3. 减去 it1
  1. assign it3 to it2.
  2. assign it2 to it1.
  3. decrement it1.



你可以重写它( C ++ 代码)这样​​:


You may rewrite it (C++ code) this way:

{
  it2 = it3;
  it1 = it2;
  it1 = it1 - 1;
}



我想Javascript代码非常相似。


I suppose Javascript code would be very similar.


这篇关于需要帮助将C ++转换为javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 01:55