public static HistogramBuffer operator+(HistogramBuffer
aHistogramBuffer1, HistogramBuffer aHistogramBuffer2) {
HistogramBuffer Tmp=new HistogramBuffer(aHistogramBuffer1);
for (int iX=0; iX<Tmp.NrOfValues; iX++) {
Tmp[iX]=Tmp[iX]+aHistogramBuffer2[iX];
}
return Tmp;
}
Now in C# I can do this:
HistogramBuffer Test1=new HistogramBuffer();
HistogramBuffer Test2=new HistogramBuffer();
Test2=Test2+Test1;
But if I do this In C++
HistogramBuffer __gc *Test1=__gc new HistogramBuffer();
HistogramBuffer __gc *Test2=__gc new HistogramBuffer();
Test2=Test2+Test1;
Then I get this error: "error C2845: '+' : cannot perform pointer arithmetic
on __gc pointer...."
Any idea how to fix this?
Within .NET Memory Profiler, I am seeing something calledicudt18l.dat, can anyone shed light on what...
By franklopez
I am working on a WTL GUI application developed by a work colleague who hassince left. I would like ...
By marcarmstrong
I am attempting to clean up some code by breaking a large mixed-modeManaged C++ library into two.I c...
By drew
Dear all,I have managed C++ code and IJW native C++ part. This IJW part loads nativeDLL. But from th...
By boni
Hi:I'm using VC 7.1. I like to have multiple actions taken after a build iscomplete. For example, I'...
By polaris, 3 Comments
Hi,I need a way to update an Edit control control in MFC from a timercallback function.How can that ...
By idlebrain, 1 Comments
In the Platform SDK: Windows User Interface, the documentation on ITextDocument, says this is delcar...
By paulogilvie, 1 Comments
Thanks Ben for the reply.I'm using the same compiler in the same way with identical code.Swapping th...
By tonyjeffs2_googlemail_com, 1 Comments
Hi,Coming from VB, I've still not really grasped the way howin C++ if function A wants to call funct...
By bentaylor, 10 Comments
--
cody
Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
"Olaf Baeyens" <olaf.baeyens...skyscan.be> schrieb im Newsbeitrag
news:41b5c7a2$0$25047$ba620e4c...news.skynet.be...
> I create a operator + in C#
> public static HistogramBuffer operator+(HistogramBuffer
> aHistogramBuffer1, HistogramBuffer aHistogramBuffer2) {
> HistogramBuffer Tmp=new HistogramBuffer(aHistogramBuffer1);
> for (int iX=0; iX<Tmp.NrOfValues; iX++) {
> Tmp[iX]=Tmp[iX]+aHistogramBuffer2[iX];
> }
> return Tmp;
> }
> Now in C# I can do this:
> HistogramBuffer Test1=new HistogramBuffer();
> HistogramBuffer Test2=new HistogramBuffer();
> Test2=Test2+Test1;
> But if I do this In C++
> HistogramBuffer __gc *Test1=__gc new HistogramBuffer();
> HistogramBuffer __gc *Test2=__gc new HistogramBuffer();
> Test2=Test2+Test1;
> Then I get this error: "error C2845: '+' : cannot perform pointer
arithmetic
> on __gc pointer...."
> Any idea how to fix this?
> --
> http://www.skyscan.be
since Test1 and Test2 are not HistogramBuffers but pointers to a
HistogramBuffer you have to write something like:
Test2 = &((*Test2)+(*Test1));
You dereference both Test2 and Test1, add them together and get the address
of the result.
But Iam not sure weather this will work :)
cody | Mon, 31 Dec 2007 15:08:00 GMT |
> since Test1 and Test2 are not HistogramBuffers but pointers to a
> HistogramBuffer you have to write something like:
> Test2 = &((*Test2)+(*Test1));
> You dereference both Test2 and Test1, add them together and get the
address
> of the result.
> But Iam not sure weather this will work :)
It doesn't compile, I also tried many variations with typecasting.
Anyway it looks very ugly if I have to do that this way.
So for the C++ I added a Add()
Like this:
Test2->Add(Test1);
While in C# I use
Test2=Test2+Test1;
Thanks for the reply. :-)
--
http://www.skyscan.be
olafbaeyens | Mon, 31 Dec 2007 15:09:00 GMT |
This works in VC 2005. Using * for __gc class instances made it almost
semantically impossible to support this in the MC++ 1.x syntax.
Ronald
"Olaf Baeyens" <olaf.baeyens...skyscan.be> wrote in message
news:41b6b741$0$25060$ba620e4c...news.skynet.be...
>> since Test1 and Test2 are not HistogramBuffers but pointers to a
>> HistogramBuffer you have to write something like:
>>
>> Test2 = &((*Test2)+(*Test1));
>>
>> You dereference both Test2 and Test1, add them together and get the
> address
>> of the result.
>>
>> But Iam not sure weather this will work :)
>>
> It doesn't compile, I also tried many variations with typecasting.
> Anyway it looks very ugly if I have to do that this way.
> So for the C++ I added a Add()
> Like this:
> Test2->Add(Test1);
> While in C# I use
> Test2=Test2+Test1;
>
> Thanks for the reply. :-)
> --
> http://www.skyscan.be
ronaldlaeremansmsft | Mon, 31 Dec 2007 15:10:00 GMT |