I am trying to understand how to interpret the declared <_Dest> () = declval <_Src> () in the implementation of is_assignable.
declval turns the type into a link. Given this, I translate the expression into one of the following four possibilities:
- _Dest && = _Src &&
- _Dest && = _Src &
- _Dest & = _Src &&
- _Dest & = _Src &
Then I created two helper functions.
template <typename T> T rvalue();
template <typename T> T& lvalue();
My understanding is that four expressions can be implemented using template functions.
- _Dest && = _Src && -----> rvalue <_Dest> () = rvalue <_Src> ()
The same applies to the other three.
decltype (declval < _Dest > () = declval < _Src > (),..), .
- _Dest = int, _src= int. # 3 # 4. is_assignable true # 3 # 4. .
- _Dest = int, _src= double. ,
- _Dest = double, _src= int. is_assignable . r. is_assignable true .
- decl < _Dest > () = declval < _Src > ()? , . , ?
- is_assignable _Dest = double, _src= int case?
.