English 中文(简体)
为什么要花这么长的时间?
原标题:why is this for loop taking so long?
  • 时间:2011-11-23 14:50:02
  •  标签:
  • c++

the:

//for testing, this is usually a value of about 27
int test = level.PathLookupVectors()[globalNodePositionIndex][globalNodeChoice].size();

for (int i = 0; i < level.PathLookupVectors()[globalNodePositionIndex][globalNodeChoice].size(); i++)
{
    //adds the correct nodes to the search
    search.push_back(level.Nodes()[level.PathLookupVectors()[globalNodePositionIndex][globalNodeChoice][i]].Index());
}

它拥有64个轨道系统。

I ger in results results results 结 果 它应被初步确定为0,但出于某种原因,其数量非常高,这反过来又意味着 lo不执行。

最佳回答

EDIT - just changed it so that it s just an int, now it gets a value of -82938723047 or some such number. why on earth is this happening? It s ruining my program!

你们几乎肯定会放弃错误的树木。 该法典:

for (int i = 0; 

......初始编号i0,期间。 如果你再次试图在浮标中夸大其价值,而浮标语说:i具有像未开发的垃圾数据等价值,那么,在<代码>i之前或之后,你或许会看<代码>i。 例如,在MSVC,如果在你第一次进入该休息室之前检查i,它通常会有停车场数据。

这不是你重新寻找的roid。 随行。

该法典更有可能:

level.PathLookupVectors()[globalNodePositionIndex][globalNodeChoice].size()

这很可能没有做你认为是做的事。

By the way, if the type of level.PathLookupVectors()[globalNodePositionIndex][globalNodeChoice] is a vector of some kind, I d prefer that you use a for loop constructed like this.

/*psudocode*/ for( vector::iterator it = v.begin(), it_end = v.end(); it != it_end; ++it )

If you don t need the index of the element you re trying to access, then why refer to it? You re just introducing another potential failure point in your code.

问题回答

暂无回答




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签