Hi there,
In my opinion, VS C++ does not fully qualify the iterator's type name due to I verify the below statement true.
std::cout << std::is_base_of_v<std::random_access_iterator_tag, std::array<int, 5>::iterator::iterator_category>; // 1(True)
I couldn't find any workaround yet.
Any idea or suggestion will be welcome.
Regards.
-----snip-----
Build started at 9:54 AM...
1>------ Build started: Project: cpp20_test, Configuration: Debug x64 ------
1>Source.cpp
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(15,24): error C2923: 'std::is_base_of_v': 'std::_Array_const_iterator<_Ty,5>::iterator_category' is not a valid template type argument for parameter '_Derived'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(15,24): error C2923: with
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(15,24): error C2923: [
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(15,24): error C2923: _Ty=int
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(15,24): error C2923: ]
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(16,19):
1>see declaration of 'std::_Array_const_iterator<_Ty,5>::iterator_category'
1> with
1> [
1> _Ty=int
1> ]
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(15,24):
1>the template instantiation context (the oldest one first) is
1> C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(39,19):
1> see reference to function template instantiation 'auto customDistance<std::_Array_const_iterator<_Ty,5>>(Iterator,Iterator)' being compiled
1> with
1> [
1> _Ty=int,
1> Iterator=std::_Array_const_iterator<int,5>
1> ]
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(16,19): error C2275: 'std::_Array_const_iterator<_Ty,5>::iterator_category': expected an expression instead of a type
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(16,19): error C2275: with
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(16,19): error C2275: [
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(16,19): error C2275: _Ty=int
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(16,19): error C2275: ]
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(16,37): error C2059: syntax error: ')'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(16,39): error C2143: syntax error: missing ';' before '{'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(13,51): error C2181: illegal else without matching if
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(15,24): error C2923: 'std::is_base_of_v': 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<_Ty>>>::iterator_category' is not a valid template type argument for parameter '_Derived'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(15,24): error C2923: with
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(15,24): error C2923: [
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(15,24): error C2923: _Ty=int
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(15,24): error C2923: ]
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(16,19):
1>see declaration of 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<_Ty>>>::iterator_category'
1> with
1> [
1> _Ty=int
1> ]
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(15,24):
1>the template instantiation context (the oldest one first) is
1> C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(41,19):
1> see reference to function template instantiation 'auto customDistance<std::_List_const_iterator<std::_List_val<std::_List_simple_types<_Ty>>>>(Iterator,Iterator)' being compiled
1> with
1> [
1> _Ty=int,
1> Iterator=std::_List_const_iterator<std::_List_val<std::_List_simple_types>>
1> ]
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(16,19): error C2275: 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<_Ty>>>::iterator_category': expected an expression instead of a type
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(16,19): error C2275: with
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(16,19): error C2275: [
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(16,19): error C2275: _Ty=int
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(16,19): error C2275: ]
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(18,20): error C2676: binary '-': 'Iterator' does not define this operator or a conversion to a type acceptable to the predefined operator
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(18,20): error C2676: with
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(18,20): error C2676: [
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(18,20): error C2676: Iterator=std::_List_const_iterator<std::_List_val<std::_List_simple_types>>
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(18,20): error C2676: ]
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.38.33130\include\xutility(1775,5):
1>could be 'unknown-type std::operator -(const std::reverse_iterator<_BidIt> &,const std::reverse_iterator<_BidIt2> &) noexcept()'
1> C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(18,16):
1> 'unknown-type std::operator -(const std::reverse_iterator<_BidIt> &,const std::reverse_iterator<_BidIt2> &) noexcept()': could not deduce template argument for 'const std::reverse_iterator<_BidIt> &' from 'Iterator'
1> with
1> [
1> Iterator=std::_List_const_iterator<std::_List_val<std::_List_simple_types>>
1> ]
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.38.33130\include\xutility(4326,30):
1>or 'unknown-type std::operator -(const std::move_iterator<_Iter> &,const std::move_iterator<_Iter2> &) noexcept()'
1> C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(18,16):
1> 'unknown-type std::operator -(const std::move_iterator<_Iter> &,const std::move_iterator<_Iter2> &) noexcept()': could not deduce template argument for 'const std::move_iterator<_Iter> &' from 'Iterator'
1> with
1> [
1> Iterator=std::_List_const_iterator<std::_List_val<std::_List_simple_types>>
1> ]
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(20,5): error C2059: syntax error: 'else'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(26,9): error C2059: syntax error: 'for'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(13,51): error C2143: syntax error: missing ')' before ';'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(26,39): error C2143: syntax error: missing ';' before '!='
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(13,51): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(26,47): error C2059: syntax error: '++'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(26,53): error C2059: syntax error: ')'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(28,9): error C2059: syntax error: '}'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(31,5): error C2059: syntax error: '}'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(41,62): error C2143: syntax error: missing ';' before '}'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(41,62): error C2059: syntax error: '}'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(42,15): error C2143: syntax error: missing ';' before '<<'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(42,15): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(42,10): error C2371: 'std::cout': redefinition; different basic types
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.38.33130\include\iostream(39,75):
1>see declaration of 'std::cout'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(43,1): error C2059: syntax error: '}'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(43,1): error C2143: syntax error: missing ';' before '}'
1>C:\Users\jmche\source\repos\Project1\cpp20_test\Source.cpp(60,1): error C1903: unable to recover from previous error(s); stopping compilation
1>Done building project "cpp20_test.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 69 up-to-date, 0 skipped ==========
========== Build completed at 9:54 AM and took 08.896 seconds ==========