3 Replies - 1712 Views - Last Post: 08 September 2012 - 10:28 AM Rate Topic: -----

#1 ClaudeP  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 9
  • Joined: 27-March 11

What does it mean when the address operator comes after the type?

Posted 08 September 2012 - 10:21 AM

I didnt know what this is called so I didnt know what to search in google. In this prototype the '&' address operator comes after the type Mat :

Mat& ScanImageAndReduceC(Mat& I, const uchar* table);


Can somone give me an explanation of what this is? I come from a Java background so Im just trying to learn this new magical syntax with C++. Thanks!
Is This A Good Question/Topic? 1
  • +

Replies To: What does it mean when the address operator comes after the type?

#2 Salem_c  Icon User is online

  • void main'ers are DOOMED
  • member icon

Reputation: 1675
  • View blog
  • Posts: 3,169
  • Joined: 30-May 10

Re: What does it mean when the address operator comes after the type?

Posted 08 September 2012 - 10:23 AM

They're called "references" in C++.
Now you have a keyword to search with ;)
Was This Post Helpful? 1
  • +
  • -

#3 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2113
  • View blog
  • Posts: 3,233
  • Joined: 21-June 11

Re: What does it mean when the address operator comes after the type?

Posted 08 September 2012 - 10:25 AM

In that context & isn't the address-of operator, it's part of the function's signature. It signifies that the function takes a reference to a Mat object and returns a reference to a Mat object (the same that a Mat* would denote a pointer to a Mat object).

For more information read up about references in C++.
Was This Post Helpful? 1
  • +
  • -

#4 ClaudeP  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 9
  • Joined: 27-March 11

Re: What does it mean when the address operator comes after the type?

Posted 08 September 2012 - 10:28 AM

Thank you very much!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1