Johannes Schaub
unread,Jun 24, 2017, 5:47:45 AM6/24/17Sign 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 std-dis...@isocpp.org
[Class.conv] says
"Type conversions of class objects can be specified by constructors
and by conversion functions. These conversions are called user-defined
conversions and are used for implicit type conversions (Clause
[conv]), for initialization, and for explicit type conversions
([expr.cast], [expr.static.cast])."
But a few paragraphs later it says
"A constructor declared without the function-specifier explicit
specifies a conversion from the types of its parameters (if any) to
the type of its class. Such a constructor is called a converting
constructor."
What does the combination of both mean? Does a non-explicit
constructor specify a conversion from the type of its parameter to the
type of its class. But an explicit constructor specifies a conversion
from an unspecified type to an unspecified type?
So far I was in the impression that only non-explicit constructors
actually specifies *conversions* (user-defined conversions), and that
explicit constructors can be used in explicit type conversion syntax,
but that these are not really "conversions". But the first sentence of
[class.conv] uses the term "conversion" for any constructor, seemingly
contradicting the later paragraph.