find all consecutive sub-array

void subArray_(vector<int> line, int n)
{
	vector<int> temp_;
	vector<int> max__sub_all;

	int first_pivot = 0;
	int second_pivot=1;

	for (int num = 1; num <=n; num++)//The length of the sub-array
	{
		for (second_pivot=num; second_pivot <=n; second_pivot++)//locate the second_pivot to the end of thesub-array
		{
			for(int i = first_pivot; i < second_pivot; i++)//travesal the sub-array
			{
				cout << line.at(i) << " ";
				temp_.push_back(line.at(i));
			}
			first_pivot++;//move back the first_pivot one step
			cout << endl;
		}
		first_pivot = 0;// re-traversal from the head of array			
	}

How to use C++ code in C#

Why cannot use C++ code in C# directly?

The most remarkable difference between C++ and C# ,i think ,is C++ is unmanaged language rather C# is managed ,which determined you can not write C++ code into the C# code directly,otherwise ,unmanaged code will seems like a runaway train in the managed code

How many ways to use C++ code in C#?

in my opinion ,the ways to use C++ code in C# depends on what you want to call.i just briefly list two type that you want call:

  • C++ function
  • C++ Class
Call C++ function by using Platform Invocation(PInvoke)

PInvoke allows for managed code to call native unmanaged functions implemented as DLLs.this method is ideal for when we have API-like function written in C or C++ that need to be accessed from within a C# program.

NOTE:PInvoke only can be used to Marshall function not to CLass.

The diagram below summarise the PInvake mechanism.

A PInvoke example

Step1 : create Dll project

there is a link aboutcreate DLL project in VS2017

Continue reading “How to use C++ code in C#”

compile Aliyu OSS C++ SDK in windows and install on VS2017

Step0 Downloadthe SDK

there is a official Link about

how to install the SDK in linux and windows

that also include the Download link.

it seems like that the folder which you downlode from github have the suffix of master.

The alibabacloud-oss-cpp-sdk.sln project file is not included in the downloaded SDK package. You must run the cmake command to generate the required project file

step1 intall the cmake

  • Install cmakeOpen cmd to go to the directory that stores the SDK files, create a folder named build, and run cmake to generate the required files, as shown in the following figure
Continue reading “compile Aliyu OSS C++ SDK in windows and install on VS2017”