xieite ::temp ()
Defined in fragment xieite :temp
(header-only:
<xieite/fn/temp.hpp>
)
Creates a temporary object which lives for the duration of the full expression which contains it.
Can be used for ignoring output parameters (
Declaration
template <typename T > [[nodiscard ]]constexpr T & temp (T && value = {})noexcept ;
Example
Output:import xieite ;void bad_api (int a ,int b ,int* out ) {int sum =a +b ; *out =sum ;xieite ::dump (sum ); }int main () {// Don't care about output parameter bad_api (1 ,2 , &xieite ::temp <int >()); }
View in Compiler Explorer3