Andrey Semashev
unread,Apr 12, 2018, 3:03:07 PM4/12/18Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ISO C++ Standard - Discussion
Hi,
I've stumbled upon this syntax in std::basic_string definition (N4659 or
N4727, [basic.string]/5):
template<class InputIterator,
class Allocator = allocator<typename
iterator_traits<InputIterator>::value_type>>
basic_string(InputIterator, InputIterator, Allocator = Allocator())
-> basic_string<typename iterator_traits<InputIterator>::value_type,
char_traits<typename iterator_traits<InputIterator>::value_type>,
Allocator>;
(sorry if I got the formatting wrong.)
This is given in namespace scope, after the std::basic_string class
template definition.
I'm failing to recognize this syntax. It looks like it should be the
constructor from a pair of iterators, but (a) it is missing the
template<...> prefix for the basic_string template parameters, (b) it is
missing the basic_string<...>:: scope prefix, (c) it uses the trailing
result type syntax, which I don't think is legal for constructors (is
it?) and (d) it has no body and it is not defaulted or deleted.
Is this something new in the language that I'm missing?
If so, why is this definition (is it a definition?) duplicated while
there is an equivalent declaration in the basic_string definition?
Thanks.