Portal:Computer programming/Selected article/9: Difference between revisions

Content deleted Content added
Reverted 1 edit by 14.141.114.47 (talk): Rv scribble. (TW)
 
(4 intermediate revisions by 3 users not shown)
Line 1:
In the [[C++]] [[programming language]], <ttcode>'''decltype'''</ttcode> is an [[Operator (programming)|operator]] for querying the [[data type|type]] of an [[Expression (programming)|expression]]. It was introduced in the current version of the C++ standard, [[C++11]]. Its primary intended use is in [[generic programming]], where it is often difficult, or even impossible, to express types that depend on [[Template (C++)|template]] parameters.
 
As [[generic programming]] techniques became increasingly popular throughout the 1990s, the need for a type-deduction mechanism was recognized. Many compiler vendors implemented their own versions of the operator, typically called <ttcode>[[typeof]]</ttcode>, and some portable implementations with limited functionality, based on existing language features were developed. In 2002, [[Bjarne Stroustrup]] proposed that a standardized version of the operator be added to the C++ language, and suggested the name "decltype", to reflect that the operator would yield the "declared type" of an expression.<noinclude>
 
{{CC-notice|cc=bysa3|url=http://en.wikipedia.org/w/index.php?title=Decltype&oldid=467958744}}</noinclude>