Talk:Opaque pointer

From Wikipedia, the free encyclopedia
Jump to: navigation, search
          This article is of interest to the following WikiProjects:
WikiProject Computing / Software (Rated Start-class, Low-importance)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 Low  This article has been rated as Low-importance on the project's importance scale.
Taskforce icon
This article is supported by WikiProject Software.
 
WikiProject C/C++ (Rated Stub-class, Low-importance)
WikiProject icon This article is within the scope of WikiProject C/C++, a collaborative effort to improve the coverage of C/C++ on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Stub-Class article Stub  This article has been rated as Stub-Class on the quality scale.
 Low  This article has been rated as Low-importance on the importance scale.
Taskforce icon
This article falls within the scope of C.
This article falls within the scope of C++.
 

C++ example[edit]

In the C++ example, I could figure out the vague benefit of swapping a temporary object, but I wouldn't call it completely obvious. It might be especially confusing to people who are only used to seeing const T& as the argument to operator=. If there is an article that discusses that in a bit more detail, it should be linked as the source, IMHO. 85.179.125.198 (talk) 18:09, 12 July 2009 (UTC)

I agree, it's certainly not completely obvious. I have added a clarifying comment. The assignment operator article linked to does mention it. Unfortunately, it is not described in as much detail as one could hope, and there is no source. I'm fairly sure the idiom is mentioned in C++ Coding Standards by Sutter & Alexandrescu, so that could probably be used as a cite. decltype (talk) 18:36, 12 July 2009 (UTC)
Decltype, the clarifying comment says something that I disagree with. I wasn't sure how to modify it to be both accurate and succinct, so I'll just point it out. The passing by value actual causes a temporary to be created, but the comment says that it eliminates a temporary.—Preceding unsigned comment added by Nolancapehart (talkcontribs)
Ah, you're quite right! It is common to refer to any automatic object used to store some intermediate result as a temporary, but that is certainly one misnomer we do not want to propagate. Thanks for pointing out this mistake. decltype (talk) 07:28, 1 March 2010 (UTC)
Guys, this affirmation is definitely wrong: In the example below, the copy assignment operator takes its argument by value, eliminating the need to explicitly create a copy of the other object.. It really does the opposite by creating a new object through the copy constructor; and not to mention it creates a lot of confusion. Iulian.serbanoiu (talk) 08:56, 11 April 2012 (UTC)

C++[edit]

In c++, there is a strong limitation about the interface of the object. There can't be any non-exported template methods in the interface of the object. (because non-exported template methods have to be defined in the include file.) And of course, the object itself can't be a template class.

As compiler supporting "export" for template methods is rare (only Comeau c++ compiler today), it may be good to indicate it.

--Heretik 0127 (talk) 01:56, 16 September 2009 (UTC)

Not quite true, in the presence of explicit instantiation. Also, the Intel C++ compiler supports export. decltype (talk) 07:20, 16 September 2009 (UTC)