xte ::lvalue ()
Defined in header <xte/math/lvalue.hpp> Casts to lvalue.
Definition
inline constexpr auto lvalue = [][[nodiscard ]](auto&& x )static noexcept ->decltype (x )& {/* ... */ };
Examples
#0[View in Compiler Explorer]static_assert (^^int& == ^^decltype (xte ::lvalue (0 )));
#1
Output:std ::println ("{}" , *std ::ranges ::find_if (xte ::lvalue (xte ::array {1 ,2 ,3 }), [](int x ) {return x >1 ; } ));
[View in Compiler Explorer]2
#2
Output:void bad_api (int a ,int b ,int* sum ) { *sum =a +b ;std ::println ("sum: {}" , *sum ); }// Don't care about out-parameter bad_api (1 ,2 , &xte ::lvalue (0 ));
[View in Compiler Explorer]sum: 3