Date: Fri, 7 Jul 2023 00:01:39 +0800
I have tested the code below in Clang, GCC and MSVC compiler.
Code #1:
auto& operator<< ( auto& os, auto&& iter )
requires requires {
{ os << *iter.begin() } -> same_as<decltype( os )>;
}
{
/* ... */
}
Only works on MSVC compiler.
Code #2:
auto& operator<< ( auto& os, auto&& iter )
requires requires {
{ operator<< ( os, *iter.begin() ) } -> same_as<decltype( os )>;
}
{
/* ... */
}
Don't work on all the compilers.
I think it should be defined in the standard, and both behaviors should be
the same.
Code #1:
auto& operator<< ( auto& os, auto&& iter )
requires requires {
{ os << *iter.begin() } -> same_as<decltype( os )>;
}
{
/* ... */
}
Only works on MSVC compiler.
Code #2:
auto& operator<< ( auto& os, auto&& iter )
requires requires {
{ operator<< ( os, *iter.begin() ) } -> same_as<decltype( os )>;
}
{
/* ... */
}
Don't work on all the compilers.
I think it should be defined in the standard, and both behaviors should be
the same.
Received on 2023-07-06 16:01:53