[declval] # 22 General utilities library [[utilities]](./#utilities) ## 22.2 Utility components [[utility]](utility#declval) ### 22.2.6 Function template declval [declval] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L508) The library provides the function template declval to simplify the definition of expressions which occur as [unevaluated operands](expr.context#def:unevaluated_operand "7.2.3 Context dependence [expr.context]")[.](#1.sentence-1) [🔗](#lib:declval) `template add_rvalue_reference_t declval() noexcept; // as unevaluated operand ` [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L518) *Mandates*: This function is not odr-used ([[basic.def.odr]](basic.def.odr#term.odr.use "6.3 One-definition rule"))[.](#2.sentence-1) [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L522) *Remarks*: The template parameter T of declval may be an incomplete type[.](#3.sentence-1) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L526) [*Example [1](#example-1)*: template decltype(static_cast(declval())) convert(From&&); declares a function template convert which only participates in overload resolution if the type From can be explicitly converted to type To[.](#4.sentence-1) For another example see class template common_type ([[meta.trans.other]](meta.trans.other "21.3.9.7 Other transformations"))[.](#4.sentence-2) — *end example*]