Hubbry Logo
DecltypeDecltypeMain
Open search
Decltype
Community hub
Decltype
logo
7 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Contribute something
Decltype
Decltype
from Wikipedia

In the C++ programming language, decltype (for "declared type") is a keyword used to query the type of an expression. Introduced in 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 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 typeof, 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.

decltype's semantics were designed to cater to both generic library writers and novice programmers. In general, the deduced type matches the type of the object or function exactly as declared in the source code. Like the sizeof[1] operator, decltype's operand is not evaluated.

Motivation

[edit]

With the introduction of templates into the C++ programming language, and the advent of generic programming techniques pioneered by the Standard Template Library, the need for a mechanism for obtaining the type of an expression, commonly referred to as typeof, was recognized. In generic programming, it is often difficult or impossible to express types that depend on template parameters,[2][3] in particular the return type of function template instantiations.[2]

Many vendors provide the typeof operator as a compiler extension.[4] As early as 1997, before C++ was fully standardized, Brian Parker proposed a portable solution based on the sizeof operator.[4] His work was expanded on by Bill Gibbons, who concluded that the technique had several limitations and was generally less powerful than an actual typeof mechanism.[4] In an October 2000 article of Dr. Dobb's Journal, Andrei Alexandrescu remarked that "having a typeof would make much template code easier to write and understand."[5] He also noted that "typeof and sizeof share the same backend, because sizeof has to compute the type anyway."[5] Andrew Koenig and Barbara E. Moo also recognized the usefulness of a built-in typeof facility, with the caveat that "using it often invites subtle programming errors, and there are some problems that it cannot solve."[6] They characterized the use of type conventions, like the typedefs provided by the Standard Template Library, as a more powerful and general technique.[6] However, Steve Dewhurst argued that such conventions are "costly to design and promulgate", and that it would be "much easier to ... simply extract the type of the expression."[7] In a 2011 article on C++0x, Koenig and Moo predicted that "decltype will be widely used to make everyday programs easier to write."[8]

In 2002, Bjarne Stroustrup suggested extending the C++ language with mechanisms for querying the type of an expression, and initializing objects without specifying the type.[2] Stroustrup observed that the reference-dropping semantics offered by the typeof operator provided by the GCC and EDG compilers could be problematic.[2] Conversely, an operator returning a reference type based on the lvalue-ness of the expression was deemed too confusing. The initial proposal to the C++ standards committee outlined a combination of the two variants; the operator would return a reference type only if the declared type of the expression included a reference. To emphasize that the deduced type would reflect the "declared type" of the expression, the operator was proposed to be named decltype.[2]

One of the cited main motivations for the decltype proposal was the ability to write perfect forwarding function templates.[9] It is sometimes desirable to write a generic forwarding function that returns the same type as the wrapped function, regardless of the type it is instantiated with. Without decltype, it is not generally possible to accomplish this.[9] An example, which also utilizes the trailing-return-type:[9]

int& foo(int& i);
float foo(float& f);

template <class T> 
auto transparent_forwarder(T& t) > decltype(foo(t)) {
     return foo(t);
}

decltype is essential here because it preserves the information about whether the wrapped function returns a reference type.[10]

Semantics

[edit]

Similarly to the sizeof operator, the operand of decltype is unevaluated, so expressions like decltype(i++) will not result in an increment of the variable i.[11] Informally, the type returned by decltype(e) is deduced as follows:[2]

  1. If the expression e refers to a variable in local or namespace scope, a static member variable or a function parameter, then the result is that variable's or parameter's declared type
  2. Otherwise, if e is an lvalue, decltype(e) is T&, where T is the type of e; if e is an xvalue, the result is T&&; otherwise, e is a prvalue and the result is T.
  3. As a special case, decltype(auto) allows for type deduction like auto but it preserves the value category of the initializer. More specifically, it is equivalent to decltype(initializer).

These semantics were designed to fulfill the needs of generic library writers, while at the same time being intuitive for novice programmers, because the return type of decltype always matches the type of the object or function exactly as declared in the source code.[2] More formally, Rule 1 applies to unparenthesized id-expressions and class member access expressions.[12][13] Example:[12] Note for added lines for bar(). Below the type deduced for "bar()" is plain int, not const int, because prvalues of non-class types always have cv-unqualified types, despite the statically declared different type.

const int&& foo();
const int bar();
int i;
struct A { double x; };
const A* a = new A();
decltype(foo()) x1; // type is const int&&
decltype(bar()) x2; // type is int
decltype(i) x3; // type is int
decltype(a->x) x4; // type is double
decltype((a->x)) x5; // type is const double&

The reason for the difference between the latter two invocations of decltype is that the parenthesized expression (a->x) is neither an id-expression nor a member access expression, and therefore does not denote a named object.[14] Because the expression is an lvalue, its deduced type is "reference to the type of the expression", or const double&.[11] The fact that extra parentheses introduce a reference qualifier to the type can be a source of errors for programmers who do not fully understand decltype.[15]

In December 2008, a concern was raised to the committee by Jaakko Järvi over the inability to use decltype to form a qualified-id,[1] which is inconsistent with the intent that decltype(e) should be treated "as if it were a typedef-name".[16] While commenting on the formal Committee Draft for C++0x, the Japanese ISO member body noted that "a scope operator(::) cannot be applied to decltype, but it should be. It would be useful in the case to obtain member type(nested-type) from an instance as follows:[17]

vector<int> v;
decltype(v)::value_type i = 0; // int i = 0;

This, and similar issues pertaining to the wording inhibiting the use of decltype in the declaration of a derived class and in a destructor call, were addressed by David Vandevoorde, and voted into the working paper in March 2010.[18][19]

Availability

[edit]

decltype is included in the C++ Language Standard since C++11.[12] It is provided by a number of compilers as an extension. Microsoft's Visual C++ 2010 and later compilers provide a decltype type specifier that closely mimics the semantics as described in the standards committee proposal. It can be used with both managed and native code.[10] The documentation states that it is "useful primarily to developers who write template libraries."[10] decltype was added to the mainline of the GCC C++ compiler in version 4.3,[20] released on March 5, 2008.[21] decltype is also present in Codegear's C++ Builder 2009,[22] the Intel C++ Compiler,[23] and Clang.[24]

References

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
decltype is a keyword in the C++ programming language, introduced in the C++11 standard, that specifies the type of an expression or named entity as determined at compile time. It enables type deduction while preserving details such as value categories (lvalue, xvalue, or prvalue) and qualifiers, making it essential for generic programming and template metaprogramming. Unlike the auto keyword, which performs type deduction without necessarily retaining reference or const qualifiers, decltype directly queries the declared type or expression category to produce precise type aliases or declarations. The syntax of decltype is decltype(expression), where the expression can be a variable, function call, or more complex construct like member access. For named entities such as variables or class members, decltype(entity) yields the exact declared type, including any cv-qualifiers (const or volatile) and types. When applied to expressions, its behavior depends on the value category: an lvalue results in T& (lvalue to type T), an xvalue in T&& (rvalue ), and a prvalue in T itself, without creating a temporary object (as clarified in C++17). For instance, if a is an int, decltype(a) is int, but decltype((a)) (noting the extra parentheses, which form an lvalue expression) is int&. decltype is particularly valuable in scenarios where standard type notation is cumbersome or impossible, such as deducing types for lambda expressions, iterator returns, or template parameters in generic code. In C++14 and later, decltype(auto) combines decltype semantics with auto for automatic deduction of return types in functions, preserving references and qualifiers to support perfect forwarding and avoid unnecessary copies. It also facilitates trailing return types in member functions, like auto f() -> decltype(g()), enhancing code readability in complex templates. Overall, decltype has become a cornerstone of modern C++ for enabling safer, more expressive type-safe programming without runtime overhead.

Background

Definition and Purpose

decltype is a keyword in the C++ programming language, introduced in the C++11 standard, that functions as an unevaluated operator to determine the declared type of an entity or the type and value category of an expression at compile time. This mechanism allows the compiler to inspect and deduce types without executing the expression, thereby avoiding the creation of temporary objects or the need for complete types in certain cases. By operating in an unevaluated context, decltype ensures that type analysis occurs purely during compilation, supporting efficient and safe code generation. The core purpose of decltype is to facilitate precise type preservation in paradigms, where types may be complex, dependent on template parameters, or derived from arbitrary expressions. It enables developers to declare variables, function return types, or other constructs that exactly match the type of an expression, including qualifiers such as const and reference types (& or &&), without resorting to lengthy or error-prone manual specifications. This capability is essential for maintaining and flexibility in templates, particularly in advanced scenarios like perfect forwarding or , where runtime overhead must be eliminated. Understanding decltype requires a basic grasp of the C++ , including the concepts of value categories—such as lvalues (expressions referring to objects with persistent storage) and rvalues (temporary or short-lived values)—which influence how types are deduced and preserved. References in C++ also play a key role, as they provide type aliases that can bind to lvalues or rvalues, allowing decltype to capture these distinctions accurately for subsequent uses in declarations. These foundational elements ensure that decltype integrates seamlessly with C++'s static type checking to support robust generic code.

Historical Development

The need for a standardized facility to deduce the type of an expression in C++ emerged in the 1990s, as gained traction and developers turned to compiler extensions—such as GCC's typeof operator, introduced around 1996—to manage intricate type computations in generic libraries without portable alternatives. This demand was underscored by pioneering work on expression templates, exemplified in Todd Veldhuizen's paper, which highlighted the challenges of expressing operation return types in numerical computing frameworks like Blitz++ (released in 1996), where non-standard typeof usage enabled compile-time optimizations but hindered portability across compilers. In response to these limitations, Bjarne Stroustrup, along with Jaakko Järvi, Douglas Gregor, and Jeremy Siek, proposed decltype in 2003 via committee document N1478 ("Decltype and auto"), aiming to provide a precise, expression-based type query that preserved reference qualifiers and addressed typeof's inconsistencies, such as varying behaviors in GCC, Microsoft Visual C++, and other implementations. The proposal was motivated by the growing complexity of generic programming, where manual type specification proved error-prone and verbose for constructs like function return types in templates. A subsequent revision, N1705 ("Decltype and auto (revision 4)") in 2004 by Järvi, Stroustrup, and Gabriel Dos Reis, further refined the deduction rules to handle operators and member accesses more accurately, ensuring compatibility with evolving template features. Decltype's path to standardization involved iterative refinements through documents like N2115 (2006) and N2343 (2007), incorporating feedback from the ISO C++ committee on and integration with library extensions in Technical Report 1 (TR1), such as type traits, which amplified the need for robust expression typing. Ultimately, after extensive debates on balancing expressiveness with simplicity, decltype was adopted as a core language feature in the standard (ISO/IEC 14882:2011), marking a pivotal advancement in type deduction for modern .

Syntax and Semantics

Syntax

The decltype specifier, introduced in C++11, takes the form decltype(expression), where expression is any valid C++ expression that undergoes unevaluated operand context, akin to the operand of sizeof. This unevaluated nature ensures the expression is not executed but is analyzed solely for its type and value category. In code, decltype can appear in variable declarations to specify the type of the declared variable, as in decltype(e) x = e;, where x receives the type of e. It is also commonly used in trailing return types for functions, enabling type deduction such as auto f() -> decltype(g());, which sets the return type to that of the call to g(). Additionally, decltype supports type aliases via using T = decltype(e);, allowing the type of e to be named for reuse elsewhere in the program. Parentheses around the expression in decltype are optional for simple id-expressions (unqualified identifiers), yielding the declared type of the entity. However, for more complex expressions involving operators or casts, enclosing the entire expression in parentheses is typically required to preserve its value category, preventing unintended promotions such as from lvalue to rvalue. For instance, decltype((x)) treats x as an lvalue, potentially adding a reference qualifier, whereas an unparenthesized complex form might alter this behavior.

Type Deduction Rules

The type deduction rules for decltype specify how the type of an unevaluated expression is determined, preserving the type and value category of the expression without executing it. These rules, introduced in C++11, are outlined in the C++ standard's clause on declarations ([dcl.type.decltype]). For an unparenthesized id-expression naming an identifier x, decltype(x) produces the declared type of the entity named by x, including any cv-qualifiers (const or volatile) and reference qualifications present in its declaration. This ensures that the deduced type exactly matches the static type of the identifier, even for references or qualified types. When the is a parenthesized expression (e), decltype((e)) treats e as an lvalue expression regardless of its original value category, yielding T& where T is the type of e if e would be an lvalue of type T. This rule distinguishes decltype from other deduction mechanisms by preserving lvalue references in such cases, which is crucial for maintaining semantics in templates. For a function call expression like f(...), decltype(f(...)) deduces the return type of the call as it would be if the function were invoked in that context, without actually evaluating the call or its arguments. The deduced type incorporates the value category of the call expression: T& for lvalues, T&& for xvalues, and T for prvalues, where T is the unqualified return type. In the case of expressions involving operators, such as a decltype(a op b), the deduction yields the type that the overall expression would have if evaluated, based on the operator's semantics and the types of its operands. For arithmetic operators like , this typically results in the arithmetic promotion or common type of a and b, adjusted for any applicable value categories.

Special Cases and Extensions

One notable special case in decltype deduction is the avoidance of lvalue promotion for non-parenthesized expressions. When applied to an unparenthesized identifier or member access expression x of type T, decltype(x) yields T directly if x is a prvalue, without adding a reference qualifier that would occur in other contexts like function argument passing. For instance, given int x = 42;, decltype(x) results in int, preserving the value category without promotion. The rules for xvalues and prvalues further distinguish decltype behavior based on value categories. An xvalue expression of type T yields T&& under decltype, as seen in decltype(std::move(x)) for an lvalue x of type T, producing T&& to enable move semantics. Similarly, a prvalue of type T yields exactly T, without materializing a temporary object (refined in later standards). In contrast, lvalue expressions yield T&, ensuring reference preservation. C++14 introduced the decltype(auto) extension, which combines auto type deduction with decltype rules to mirror the exact type, including references and value categories, of the initializer. For example, decltype(auto) y = x; where x is an lvalue of type T deduces y as T&, unlike plain auto which would deduce T. This feature is particularly useful for forwarding functions or maintaining precise return types in generic code. Subsequent standards refined decltype interactions without altering its core mechanics. In , decltype applied to structured bindings yields the referenced type of the binding, such as T& for an lvalue reference element in a tuple-like decomposition. also eliminated temporary materialization for prvalues in unevaluated contexts like decltype, improving efficiency. extended this by handling constant template parameters as non-const types and integrating with init-statements in if and switch without major changes to deduction rules. These refinements enhance in modern constructs like range-based loops or conditional initializations.

Usage

Basic Examples

One of the fundamental uses of decltype is in variable declarations, where it deduces the type of an existing variable and applies it to a new one, preserving qualifiers like const. For instance, consider the following code:

cpp

int i = 42; decltype(i) j = i;

int i = 42; decltype(i) j = i;

Here, j is deduced to be of type int, matching the type of i. decltype is also essential for specifying return types in function templates, particularly when the result depends on the argument types, ensuring type safety without explicit type listing. A common example is a templated addition function using a trailing return type:

cpp

template<typename T> auto add(T a, T b) -> decltype(a + b) { return a + b; }

template<typename T> auto add(T a, T b) -> decltype(a + b) { return a + b; }

In this case, the return type is deduced as the type of a + b, which for int arguments would be int, allowing the function to work generically across compatible types. Additionally, decltype facilitates creating type aliases for expressions, enabling cleaner code by naming complex or variable-derived types. For example:

cpp

double d = 3.14; using Coord = decltype(d);

double d = 3.14; using Coord = decltype(d);

This aliases Coord to double, the type of d, which can then be used throughout the code as a shorthand for the floating-point type.

Advanced Applications

One advanced application of decltype lies in perfect forwarding within template functions, where it enables precise deduction of return types that preserve value categories, references, and qualifiers from forwarded arguments. For instance, consider a generic forwarding wrapper that invokes a callable while maintaining the exact return semantics:

cpp

template<class F, class... Args> decltype(auto) perfect_forward(F&& fun, Args&&... args) { return fun(std::forward<Args>(args)...); }

template<class F, class... Args> decltype(auto) perfect_forward(F&& fun, Args&&... args) { return fun(std::forward<Args>(args)...); }

Here, decltype(auto) deduces the return type based on the expression fun(std::forward<Args>(args)...), ensuring that if the callable returns a reference (e.g., int&), the wrapper does so as well, which is crucial for avoiding unnecessary copies in generic code. This idiom is particularly valuable in library implementations, such as utility functions or constructors, where template argument deduction must align perfectly with the underlying callable's signature. Another sophisticated use involves trailing return types in lambdas, especially generic ones, allowing the to infer complex return types dependent on auto-deduced parameters. In C++14 and later, this facilitates concise, type-safe :

cpp

auto comparator = [](auto a, auto&& b) -> decltype(a < b) { return a < b; }; bool result = comparator(3, 3.14); // Deduced as bool

auto comparator = [](auto a, auto&& b) -> decltype(a < b) { return a < b; }; bool result = comparator(3, 3.14); // Deduced as bool

The decltype(a < b) expression evaluates the operator's result type at compile time, adapting to the arguments' types (e.g., yielding bool for mixed integer and floating-point inputs), which supports polymorphic behavior without explicit template parameters. This approach is essential in algorithms or higher-order functions where return types vary based on input combinations, enhancing code reusability in modern C++ libraries. decltype also proves indispensable for type extraction in generic container handling, particularly when working with or nested types in template metaprogramming. For example, to alias a container's value type without assuming a specific class:

cpp

std::vector<int> container{1, 2, 3}; using value_type = typename decltype(container)::value_type; // int using iterator_type = decltype(container.begin()); // std::vector<int>::iterator

std::vector<int> container{1, 2, 3}; using value_type = typename decltype(container)::value_type; // int using iterator_type = decltype(container.begin()); // std::vector<int>::iterator

This deduces value_type directly from the container's nested and the iterator type from begin(), enabling portable generic code that operates on any standard without hardcoding types. Such patterns are common in -based algorithms or range libraries, where decltype bridges runtime objects to compile-time type traits, supporting efficient, standards-compliant abstractions.

Comparison with auto

decltype and auto are both type deduction mechanisms introduced in C++11, but they differ fundamentally in how they infer types from expressions. The auto keyword deduces the type by applying template argument deduction rules to the initializer, which effectively discards top-level cv-qualifiers and references, resulting in the base type T. In contrast, decltype preserves the exact declared type of the expression, including cv-qualifiers, references, and the value category (lvalue, xvalue, or prvalue). This preservation makes decltype suitable for scenarios requiring precise type matching, such as in where value categories affect behavior. A clear example of this difference arises with lvalue expressions. Consider an integer variable int z = 10;. Declaring auto y = z; infers y as int, treating the lvalue initializer as a non-reference type after decay. However, decltype(z) yields int, while decltype((z))—noting the extra parentheses to form an lvalue expression—yields int&, preserving the reference nature. For a constant, const int x = 5; auto a = x; deduces a as int, discarding the const qualifier, whereas decltype(x) is const int. These contrasts highlight how auto simplifies type inference by stripping qualifiers, potentially leading to unintended copies or loss of const-correctness. In practice, auto is preferred for simplifying variable declarations in everyday code, where the exact qualifiers are not critical and ease of use outweighs precision. decltype, on the other hand, is essential in advanced templates, such as defining return types that must match the value category of expressions to enable perfect forwarding or avoid unnecessary temporaries. For instance, in generic functions, using decltype ensures the deduced type respects whether an argument is an lvalue , which auto alone might not. The decltype(auto) construct, introduced in C++14, bridges these behaviors by combining auto's deduction with decltype's preservation rules.

Integration with Other C++ Mechanisms

decltype plays a crucial role in by enabling substitution failure is not an error (SFINAE) mechanisms, particularly when combined with std::enable_if for conditional type selection. In such scenarios, decltype allows detection of whether certain expressions, such as function return types, are valid for a given type, thereby enabling or disabling template specializations at compile time. For instance, to conditionally enable a template based on the return type of a function, one can use std::enable_if with a decltype expression that attempts to invoke the function on dummy arguments; if the invocation yields the expected type, the template is enabled, otherwise, substitution fails silently. A representative example involves detecting if a function returns an arithmetic type:

cpp

#include <type_traits> template <typename F, typename... Args> using returns_arithmetic = std::enable_if_t< std::is_arithmetic_v<decltype(std::declval<F>()(std::declval<Args>()...))> >; template <typename F, typename... Args> void invoke_if_arithmetic(F f, Args... args) -> returns_arithmetic<F, Args...> { // Implementation here }

#include <type_traits> template <typename F, typename... Args> using returns_arithmetic = std::enable_if_t< std::is_arithmetic_v<decltype(std::declval<F>()(std::declval<Args>()...))> >; template <typename F, typename... Args> void invoke_if_arithmetic(F f, Args... args) -> returns_arithmetic<F, Args...> { // Implementation here }

This pattern ensures that invoke_if_arithmetic is only viable if the deduced return type matches the arithmetic constraint, leveraging SFINAE to discard invalid overloads. In C++20, decltype integrates with lambda expressions and concepts to facilitate constrained type deduction in generic lambdas. Specifically, within a lambda's requires clause, decltype can inspect the type of a parameter (often deduced via auto) to apply concept-based constraints, ensuring that the lambda only accepts arguments satisfying the specified requirements. This allows for precise control over lambda applicability without explicit template parameters. For example:

cpp

auto lambda = [](auto x) requires std::integral<decltype(x)> { return x + 1; };

auto lambda = [](auto x) requires std::integral<decltype(x)> { return x + 1; };

Here, decltype(x) captures the deduced type of x, enabling the std::[integral](/page/Integral) concept to constrain it to types at . decltype further enhances structured bindings introduced in C++17 by allowing of the referenced types of binding elements, particularly for tuple-like objects. When applied to a structured binding declaration, decltype yields the type of the referenced element as if accessed via std::get<I>(e), where I is the binding index and e is the bound entity. This is useful for tasks that require knowing element types without performing the binding. For instance, given a tuple t = std::make_tuple(1.0f, 'a', 42);, the type of the first element can be inferred as decltype(std::get<0>(t)), which is float in this case, facilitating type-safe operations on components.

Standardization and Support

Evolution in C++ Standards

decltype was first standardized as part of the revision, where it was specified in the core language section on simple type specifiers. The feature allows the deduction of the type of an expression while preserving value category and reference qualifications, as detailed in section 7.1.6.2 of ISO/IEC 14882:2011. This baseline definition provided programmers with a mechanism to handle complex scenarios without explicitly naming types, marking a significant advancement in type deduction capabilities. In the C++14 standard, decltype was extended with the decltype(auto) construct to address limitations in the auto keyword's deduction rules, particularly for references and cv-qualifiers. This addition enables uniform type deduction that aligns auto's behavior more closely with decltype, allowing for more precise forwarding of types in generic code. The specification for this enhancement appears in ISO/IEC 14882:2014, enhancing the interoperability between auto and decltype in function return types and variable declarations. Subsequent standards introduced minor clarifications to decltype without altering its fundamental semantics. For instance, C++17's fold expressions utilize decltype for consistent type deduction during pack expansions in variadic templates, as outlined in ISO/IEC 14882:2017. Similarly, included adjustments related to s, such as in promise type handling where decltype aids in deducing coroutine return types, per ISO/IEC 14882:2020. No deprecations occurred, and preserved the feature's status quo, with ISO/IEC 14882:2024 maintaining prior specifications.

Compiler and Implementation Support

Support for the decltype specifier was first introduced experimentally in GCC 4.3 in 2008, providing partial implementation of the feature as part of early C++0x experimentation, with full conformance achieved in GCC 4.8.1 released in 2013. offered initial support starting with version 2.9 in 2010, enabling basic usage of decltype for type deduction in expressions. Microsoft Visual C++ (MSVC) introduced support in 2010 (MSVC 10.0), though initially partial, with complete implementation in 2012 (MSVC 11.0). As of November 2025, decltype enjoys universal support across major compilers, with full integration in GCC 15.2 and later (released August 2025 onward), 21.1.6 and subsequent versions (released November 2025), and MSVC in Visual Studio 2022 (version 17.0+), extending to advanced usages such as in extended type traits without reported issues in core functionality. This maturity aligns with the feature's stabilization in the standard, allowing seamless adoption in production codebases. In embedded environments, support varies by version. IAR Embedded Workbench for (EWARM) provided partial compliance starting around version 6.40 in 2011, with full support in recent releases like EW 9.x that encompass all and later features. Similarly, Keil - using 5 (armcc) offered partial decltype support from version 5.05 onward, limited by exclusions of certain extensions like N3276 for call expressions, but transitioned to full compliance in 6 (Clang-based) integrated since MDK 5.30 in 2018.

References

Add your contribution
Related Hubs
Contribute something
User Avatar
No comments yet.