I recently experimented with C ++ concepts. I am trying to use the definitions from the following Extensions documents:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4569.pdf
Definitions and customs Sameconfuse me. For reasons unknown to me, the authors did not give an explicit definition. Therefore, I use:
template <class T, class U>
concept bool Same()
{
return std::is_same<T, U>::value;
}
The problem is that the document gives the following definition for Assignable:
template <class T, class U>
concept bool Assignable()
{
return Common<T, U>() && requires(T&& a, U&& b) {
{ std::forward<T>(a) = std::forward<U>(b) } -> Same<T&>;
};
}
This does not work (under GCC 6.3): a simple check Assignable<int&, int&&>()gives me false(I confirmed that the part Commonis ok). I need to change Same<T&>to T&so that it looks like it works. The same tags are Same<Type>also used in some other places.
My questions:
- Is my definition correct
Same? Same<T&> T&? ?
.