Код, который не справляется с clang (хотя gcc, похоже, с ним согласен)
int arr[] { 111, 222, 333};
ranges::subrange(
ranges::begin(arr),ranges::end(arr) );
Похоже, что в поддиапазоне clang-заявки gcc нет функции начала?!
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/iterator_concepts.h:953:35: note: and 'std::ranges::subrange &' does not satisfy '__member_begin'
requires is_array_v || __member_begin || __adl_begin
^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/iterator_concepts.h:937:33: note: because '__detail::__decay_copy(__t.begin())' would be invalid: no member named 'begin' in 'std::ranges::subrange'
{ __detail::__decay_copy(__t.begin()) } -> input_or_output_iterator;
^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/iterator_concepts.h:953:59: note: and 'std::ranges::subrange &' does not satisfy '__adl_begin'
requires is_array_v || __member_begin || __adl_begin
[LIVE]
часть iterator_concepts.h gcc:
namespace __detail
{
template
constexpr decay_t
__decay_copy(_Tp&& __t)
noexcept(is_nothrow_convertible_v)
{ return std::forward(__t); }
template
concept __member_begin = requires(_Tp& __t)
{
{ __detail::__decay_copy(__t.begin()) } -> input_or_output_iterator;
};
void begin(auto&) = delete;
void begin(const auto&) = delete;
template
concept __adl_begin = __class_or_enum
&& requires(_Tp& __t)
{
{ __detail::__decay_copy(begin(__t)) } -> input_or_output_iterator;
};
// Simplified version of std::ranges::begin that only supports lvalues,
// for use by __range_iter_t below.
template
requires is_array_v || __member_begin || __adl_begin
auto
__ranges_begin(_Tp& __t)
{
if constexpr (is_array_v)
{
static_assert(sizeof(remove_all_extents_t) != 0,
"not array of incomplete type");
return __t + 0;
}
else if constexpr (__member_begin)
return __t.begin();
else
return begin(__t);
}
// Implementation of std::ranges::iterator_t, without using ranges::begin.
template
using __range_iter_t
= decltype(__detail::__ranges_begin(std::declval()));
} // namespace __detail
Подробнее здесь: https://stackoverflow.com/questions/643 ... gin-functi
Почему clang считает, что поддиапазон gcc не удовлетворяет требованиям концепции функции gcc __range Begin? ⇐ C++
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Почему while(end > Begin) не сработало, а while(begin <= end) сработало? [закрыто]
Anonymous » » в форуме JAVA - 0 Ответы
- 118 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Может кто-нибудь объяснить, что именно делает строка 10? "reverse(s.begin()+j, s.begin()+i);"
Anonymous » » в форуме C++ - 0 Ответы
- 17 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Может кто-нибудь объяснить, что именно делает строка 10? "reverse(s.begin()+j, s.begin()+i);"
Anonymous » » в форуме C++ - 0 Ответы
- 22 Просмотры
-
Последнее сообщение Anonymous
-