references in cli

  • Thread starter Zoran Stipanicev
  • Start date
Z

Zoran Stipanicev

Hi!

I have a problem in converting code below from native c++ to .net cli:

//native c++
typedef float tip;

tip* conteiner_;

tip& Element_(int r, int c)
{
return conteiner_[r];
}

I've tried this:
//.net cli
typedef System::Single tip;

array<tip>^ conteiner_;

tip& Element_(int r, int c)
{
return conteiner_[r];
}

but I get the error that "tip" can't be converted to "tip&".

Thx!

Best regards,
Zoran Stipanicev.
 
H

Holger Grund

Zoran Stipanicev said:
//native c++
typedef float tip;

tip* conteiner_;

tip& Element_(int r, int c)
{
return conteiner_[r];
}

I've tried this:
//.net cli
typedef System::Single tip;

array<tip>^ conteiner_;

tip& Element_(int r, int c)
{
return conteiner_[r];
}

but I get the error that "tip" can't be converted to "tip&".
tip& is an unmanaged reference. If you want what the CLR
calls a managed pointer you should use tip%.

-hg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top