|
-
Aug 26th, 2012, 01:22 PM
#9
Thread Starter
Member
Re: C++ to C#
Look at C++: in Breadth_first_search(queue<int> &Q, vector<int> &trace, bool grid[][maxx], int start, int nodes) and Trace_result(vector<int> &trace, int start, int end, int nodes)
I see: &Q and &trace is passing value???? So i code in C#:ref queue<int> Q and ref List<int> trace.
So, after, whatever i edit, it seem error in: trace[start] = 1:
System.ArgumentOutOfRangeException was unhandled
Message=Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Source=mscorlib
ParamName=index
StackTrace:
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.set_Item(Int32 index, T value)
at ConsoleApplication1.Program.Breadth_first_search(Queue`1& Q, List`1& trace, Boolean[,] grid, Int32 start, Int32 nodes) in C:\Users\Longbottom-up\Desktop\thu\ConsoleApplication1\ConsoleApplication1\Program.cs:line 35
at ConsoleApplication1.Program.Main() in C:\Users\Longbottom-up\Desktop\thu\ConsoleApplication1\ConsoleApplication1\Program.cs:line 126
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|