Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<vector>: Superior string splitting (std::views::split) issue with VS2002 17.4 Preview 2 #3109

Closed
fsb4000 opened this issue Sep 17, 2022 · 6 comments
Labels
invalid This issue is incorrect or by design

Comments

@fsb4000
Copy link
Contributor

fsb4000 commented Sep 17, 2022

Describe the bug
An example from https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2210r0.html#design doesn't work but it worked in 17.3

Command-line test case

C:\Temp>type main.cpp
#include <string>
#include <ranges>
#include <vector>

int main()
{
	std::string ip = "127.0.0.1";
	auto parts = ip | std::views::split('.');
	auto as_vec = std::vector<std::string>(parts.begin(), parts.end());
	return 0;
}
C:\Temp>cl /std:c++latest /EHsc /W4 /WX .\main.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31823.3 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

/std:c++latest is provided as a preview of language features from the latest C++
working draft, and we're eager to hear about bugs and suggestions for improvements.
However, note that these features are provided as-is without support, and subject
to changes or removal as the working draft evolves. See
https://go.microsoft.com/fwlink/?linkid=2045807 for details.

main.cpp
C:\Dev\STL\out\build\x64\out\inc\xutility(217): error C2665: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string': no overloaded function could convert all the argument types
C:\Dev\STL\out\build\x64\out\inc\xstring(2678): note: could be 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::nullptr_t)'
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::nullptr_t)': cannot convert argument 1 from '_Ty' to 'std::nullptr_t'
        with
        [
            _Ty=std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::ranges::subrange_kind::sized>
        ]
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Dev\STL\out\build\x64\out\inc\xstring(2673): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Elem *const )'
        with
        [
            _Elem=char
        ]
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Elem *const )': cannot convert argument 1 from '_Ty' to 'const _Elem *const '
        with
        [
            _Elem=char
        ]
        and
        [
            _Ty=std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::ranges::subrange_kind::sized>
        ]
        and
        [
            _Elem=char
        ]
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Dev\STL\out\build\x64\out\inc\xstring(3221): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::initializer_list<_Elem>,const _Alloc &)'
        with
        [
            _Elem=char,
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::initializer_list<_Elem>,const _Alloc &)': cannot convert argument 1 from '_Ty' to 'std::initializer_list<_Elem>'
        with
        [
            _Elem=char,
            _Alloc=std::allocator<char>
        ]
        and
        [
            _Ty=std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::ranges::subrange_kind::sized>
        ]
        and
        [
            _Elem=char
        ]
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Dev\STL\out\build\x64\out\inc\xstring(2619): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Alloc &) noexcept'
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Alloc &) noexcept': cannot convert argument 1 from '_Ty' to 'const _Alloc &'
        with
        [
            _Alloc=std::allocator<char>
        ]
        and
        [
            _Ty=std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::ranges::subrange_kind::sized>
        ]
        and
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: Reason: cannot convert from '_Ty' to 'const _Alloc'
        with
        [
            _Ty=std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::ranges::subrange_kind::sized>
        ]
        and
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Dev\STL\out\build\x64\out\inc\xstring(3028): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Ty &,const unsigned __int64,const unsigned __int64,const _Alloc &)'
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Ty &,const unsigned __int64,const unsigned __int64,const _Alloc &)': expects 4 arguments - 1 provided
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xstring(3028): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string'
C:\Dev\STL\out\build\x64\out\inc\xstring(3021): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _StringViewIsh &,const _Alloc &)'
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _StringViewIsh &,const _Alloc &)': could not deduce template argument for '__formal'
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xstring(3021): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string'
C:\Dev\STL\out\build\x64\out\inc\xstring(2871): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::from_range_t,_Rng &&,const _Alloc &)'
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::from_range_t,_Rng &&,const _Alloc &)': expects 3 arguments - 1 provided
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xstring(2871): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string'
C:\Dev\STL\out\build\x64\out\inc\xstring(2703): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(_Iter,_Iter,const _Alloc &)'
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(_Iter,_Iter,const _Alloc &)': expects 3 arguments - 1 provided
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xstring(2703): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string'
C:\Dev\STL\out\build\x64\out\inc\xstring(2697): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const unsigned __int64,const _Elem,const _Alloc &)'
        with
        [
            _Elem=char,
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const unsigned __int64,const _Elem,const _Alloc &)': expects 3 arguments - 1 provided
        with
        [
            _Elem=char,
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xstring(2697): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string'
C:\Dev\STL\out\build\x64\out\inc\xstring(2684): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Elem *const ,const _Alloc &)'
        with
        [
            _Elem=char,
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Elem *const ,const _Alloc &)': expects 2 arguments - 1 provided
        with
        [
            _Elem=char,
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xstring(2684): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string'
C:\Dev\STL\out\build\x64\out\inc\xutility(217): note: while trying to match the argument list '(_Ty)'
        with
        [
            _Ty=std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::ranges::subrange_kind::sized>
        ]
C:\Dev\STL\out\build\x64\out\inc\xutility(216): note: see reference to function template instantiation '_Ty *std::construct_at<_Objty,std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::ranges::subrange_kind::sized>,0x0>(_Ty *const ,std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::ranges::subrange_kind::sized> &&) noexcept(<expr>)' being compiled
        with
        [
            _Ty=std::basic_string<char,std::char_traits<char>,std::allocator<char>>,
            _Objty=std::basic_string<char,std::char_traits<char>,std::allocator<char>>,
            _Elem=char
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(1662): note: see reference to function template instantiation 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::ranges::subrange_kind::sized>>(_Alloc &,_Objty *const ,std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::ranges::subrange_kind::sized> &&)' being compiled
        with
        [
            _Alloc=std::allocator<std::string>,
            _Ty=std::basic_string<char,std::char_traits<char>,std::allocator<char>>,
            _Elem=char,
            _Objty=std::basic_string<char,std::char_traits<char>,std::allocator<char>>
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(1663): note: see reference to function template instantiation 'void std::_Default_allocator_traits<_Alloc>::construct<_Ty,std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::ranges::subrange_kind::sized>>(_Alloc &,_Objty *const ,std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::ranges::subrange_kind::sized> &&)' being compiled
        with
        [
            _Alloc=std::allocator<std::string>,
            _Ty=std::basic_string<char,std::char_traits<char>,std::allocator<char>>,
            _Elem=char,
            _Objty=std::basic_string<char,std::char_traits<char>,std::allocator<char>>
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(1680): note: see reference to function template instantiation 'void std::_Uninitialized_backout_al<std::allocator<std::string>>::_Emplace_back<std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::ranges::subrange_kind::sized>>(std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::ranges::subrange_kind::sized> &&)' being compiled
        with
        [
            _Elem=char
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(1717): note: see reference to function template instantiation 'void std::_Uninitialized_backout_al<std::allocator<std::string>>::_Emplace_back<std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::ranges::subrange_kind::sized>>(std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::ranges::subrange_kind::sized> &&)' being compiled
        with
        [
            _Elem=char
        ]
C:\Dev\STL\out\build\x64\out\inc\vector(2119): note: see reference to function template instantiation 'std::basic_string<char,std::char_traits<char>,std::allocator<char>> *std::_Uninitialized_copy<_Ty,_Ty,std::allocator<std::string>>(_InIt,_Se,std::basic_string<char,std::char_traits<char>,std::allocator<char>> *,_Alloc &)' being compiled
        with
        [
            _Ty=std::ranges::split_view<std::ranges::ref_view<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::ranges::single_view<char>>::_Iterator,
            _InIt=std::ranges::split_view<std::ranges::ref_view<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::ranges::single_view<char>>::_Iterator,
            _Se=std::ranges::split_view<std::ranges::ref_view<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::ranges::single_view<char>>::_Iterator,
            _Alloc=std::allocator<std::string>
        ]
C:\Dev\STL\out\build\x64\out\inc\vector(705): note: see reference to function template instantiation 'void std::vector<std::string,std::allocator<std::string>>::_Construct_n<std::ranges::split_view<std::ranges::ref_view<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::ranges::single_view<char>>::_Iterator,std::ranges::split_view<std::ranges::ref_view<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::ranges::single_view<char>>::_Iterator>(const unsigned __int64,std::ranges::split_view<std::ranges::ref_view<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::ranges::single_view<char>>::_Iterator &&,std::ranges::split_view<std::ranges::ref_view<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::ranges::single_view<char>>::_Iterator &&)' being compiled
C:\Dev\STL\out\build\x64\out\inc\vector(705): note: see reference to function template instantiation 'void std::vector<std::string,std::allocator<std::string>>::_Construct_n<std::ranges::split_view<std::ranges::ref_view<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::ranges::single_view<char>>::_Iterator,std::ranges::split_view<std::ranges::ref_view<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::ranges::single_view<char>>::_Iterator>(const unsigned __int64,std::ranges::split_view<std::ranges::ref_view<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::ranges::single_view<char>>::_Iterator &&,std::ranges::split_view<std::ranges::ref_view<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::ranges::single_view<char>>::_Iterator &&)' being compiled
.\main.cpp(9): note: see reference to function template instantiation 'std::vector<std::string,std::allocator<std::string>>::vector<std::ranges::split_view<std::ranges::ref_view<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::ranges::single_view<char>>::_Iterator,0>(_Iter,_Iter,const _Alloc &)' being compiled
        with
        [
            _Iter=std::ranges::split_view<std::ranges::ref_view<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::ranges::single_view<char>>::_Iterator,
            _Alloc=std::allocator<std::string>
        ]
.\main.cpp(9): note: see reference to function template instantiation 'std::vector<std::string,std::allocator<std::string>>::vector<std::ranges::split_view<std::ranges::ref_view<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::ranges::single_view<char>>::_Iterator,0>(_Iter,_Iter,const _Alloc &)' being compiled
        with
        [
            _Iter=std::ranges::split_view<std::ranges::ref_view<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>,std::ranges::single_view<char>>::_Iterator,
            _Alloc=std::allocator<std::string>
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(680): error C2665: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string': no overloaded function could convert all the argument types
C:\Dev\STL\out\build\x64\out\inc\xstring(2678): note: could be 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::nullptr_t)'
C:\Dev\STL\out\build\x64\out\inc\xmemory(680): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::nullptr_t)': cannot convert argument 1 from '_Ty' to 'std::nullptr_t'
        with
        [
            _Ty=std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::ranges::subrange_kind::sized>
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(680): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Dev\STL\out\build\x64\out\inc\xstring(2673): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Elem *const )'
        with
        [
            _Elem=char
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(680): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Elem *const )': cannot convert argument 1 from '_Ty' to 'const _Elem *const '
        with
        [
            _Elem=char
        ]
        and
        [
            _Ty=std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::ranges::subrange_kind::sized>
        ]
        and
        [
            _Elem=char
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(680): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Dev\STL\out\build\x64\out\inc\xstring(3221): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::initializer_list<_Elem>,const _Alloc &)'
        with
        [
            _Elem=char,
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(680): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::initializer_list<_Elem>,const _Alloc &)': cannot convert argument 1 from '_Ty' to 'std::initializer_list<_Elem>'
        with
        [
            _Elem=char,
            _Alloc=std::allocator<char>
        ]
        and
        [
            _Ty=std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::ranges::subrange_kind::sized>
        ]
        and
        [
            _Elem=char
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(680): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Dev\STL\out\build\x64\out\inc\xstring(2619): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Alloc &) noexcept'
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(680): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Alloc &) noexcept': cannot convert argument 1 from '_Ty' to 'const _Alloc &'
        with
        [
            _Alloc=std::allocator<char>
        ]
        and
        [
            _Ty=std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::ranges::subrange_kind::sized>
        ]
        and
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(673): note: Reason: cannot convert from '_Ty' to 'const _Alloc'
        with
        [
            _Ty=std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::ranges::subrange_kind::sized>
        ]
        and
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(680): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Dev\STL\out\build\x64\out\inc\xstring(3028): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Ty &,const unsigned __int64,const unsigned __int64,const _Alloc &)'
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(680): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Ty &,const unsigned __int64,const unsigned __int64,const _Alloc &)': expects 4 arguments - 1 provided
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xstring(3028): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string'
C:\Dev\STL\out\build\x64\out\inc\xstring(3021): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _StringViewIsh &,const _Alloc &)'
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(673): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _StringViewIsh &,const _Alloc &)': could not deduce template argument for '__formal'
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xstring(3021): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string'
C:\Dev\STL\out\build\x64\out\inc\xstring(2871): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::from_range_t,_Rng &&,const _Alloc &)'
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(680): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(std::from_range_t,_Rng &&,const _Alloc &)': expects 3 arguments - 1 provided
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xstring(2871): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string'
C:\Dev\STL\out\build\x64\out\inc\xstring(2703): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(_Iter,_Iter,const _Alloc &)'
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(680): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(_Iter,_Iter,const _Alloc &)': expects 3 arguments - 1 provided
        with
        [
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xstring(2703): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string'
C:\Dev\STL\out\build\x64\out\inc\xstring(2697): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const unsigned __int64,const _Elem,const _Alloc &)'
        with
        [
            _Elem=char,
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(680): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const unsigned __int64,const _Elem,const _Alloc &)': expects 3 arguments - 1 provided
        with
        [
            _Elem=char,
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xstring(2697): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string'
C:\Dev\STL\out\build\x64\out\inc\xstring(2684): note: or       'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Elem *const ,const _Alloc &)'
        with
        [
            _Elem=char,
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xmemory(680): note: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const _Elem *const ,const _Alloc &)': expects 2 arguments - 1 provided
        with
        [
            _Elem=char,
            _Alloc=std::allocator<char>
        ]
C:\Dev\STL\out\build\x64\out\inc\xstring(2684): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string'
C:\Dev\STL\out\build\x64\out\inc\xmemory(673): note: while trying to match the argument list '(_Ty)'
        with
        [
            _Ty=std::ranges::subrange<std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,std::ranges::subrange_kind::sized>
        ]

Expected behavior
Should compile

STL version

  • Option 2: git commit hash
https://github.com/microsoft/STL/commit/67a96a910fb53aa4bc12801fb9683d30b2647c16

Additional context
Devcom-10150447

@fsb4000

This comment was marked as outdated.

@fsb4000

This comment was marked as outdated.

@fsb4000
Copy link
Contributor Author

fsb4000 commented Sep 17, 2022

I found the commit: #2947 via git bisect

git bisect good
6db1eb4489659f801eea1652ae1024bbac252a2b is the first bad commit
commit 6db1eb4489659f801eea1652ae1024bbac252a2b
Author: Sam Huang <samestimable2016@gmail.com>
Date:   Wed Jul 27 20:55:36 2022 -0700

    Implement P2499R0: `string_view` Range Constructor Should Be `explicit` (#2947)

 stl/inc/xstring                              | 2 +-
 stl/inc/yvals_core.h                         | 1 +
 tests/libcxx/expected_results.txt            | 4 ++++
 tests/libcxx/skipped_tests.txt               | 4 ++++
 tests/std/tests/P0220R1_string_view/test.cpp | 4 +++-
 5 files changed, 13 insertions(+), 2 deletions(-)

@fsb4000
Copy link
Contributor Author

fsb4000 commented Sep 17, 2022

Well, I think this is expected now because: static_assert(!is_convertible_v<vector<char>, string_view>);
And they just need to change their code.
This code works:

#include <string>
#include <ranges>
#include <vector>
#include <iostream>
using namespace std;
int main()
{
	auto ip = "127.0.0.1"s;
	auto parts = ip | views::split('.');
	auto as_vec =  ranges::to<vector<string>>(parts);
	for (const auto& s: as_vec) {
		cout << s << '\n';
	}
	return 0;
}
$ main.exe
127
0
0
1

@fsb4000
Copy link
Contributor Author

fsb4000 commented Sep 17, 2022

I answered that this is by design: https://developercommunity.visualstudio.com/t/10150447#T-N10150782

@strega-nil-ms
Copy link
Contributor

Closing as, as @fsb4000 points out, this is by design. Thanks!

@strega-nil-ms strega-nil-ms closed this as not planned Won't fix, can't repro, duplicate, stale Sep 21, 2022
@strega-nil-ms strega-nil-ms added the invalid This issue is incorrect or by design label Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This issue is incorrect or by design
Projects
None yet
Development

No branches or pull requests

2 participants