Topic: When to use DefaultConstructible and
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Mon, 27 May 2013 08:19:44 +0200
Raw View
Hi,
s this a minor historic editorial issue?
The standard uses DefaultConstructible and is_default_constructible
indistinctly in the Requires clauses:
- T shall satisfy the requirements of DefaultConstructible
- is_default_constructible<T>::value is true
* Do those descriptions mean the same thing? If yes, shouldn't the trait
be defined in function of the Requirements?
* Which one should be used on the Requires clauses?
Best,
Vicente
P.S. The same is applicable to other requirements that have an
associated type trait.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
.
Author: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@gmail.com>
Date: Mon, 27 May 2013 08:31:07 +0200
Raw View
2013/5/27 Vicente J. Botet Escriba <vicente.botet@wanadoo.fr>:
> Hi,
>
> s this a minor historic editorial issue?
No.
> The standard uses DefaultConstructible and is_default_constructible
> indistinctly in the Requires clauses:
> - T shall satisfy the requirements of DefaultConstructible
> - is_default_constructible<T>::value is true
>
> * Do those descriptions mean the same thing?
No. A requirement DefaultConstructible has *both* semantic and
syntactic requirements, a requirement based on
is_default_constructible has mainly syntactic requirements (The only
exception would be the requirements on using that trait itself). What
is_default_constructible tests is also a *single* syntactic test,
while DefaultConstructible does more than this (see Table 19).
> If yes, shouldn't the trait be
> defined in function of the Requirements?
No. The design was intentionally done to concentrate on purely
syntactic tests. The originally proposed concepts allowed to express
the textual requirements expressed in language form. I think what you
want to realize is by looking into the directions of concepts (light).
> * Which one should be used on the Requires clauses?
It depends on what you want to realize. Keep in mind that focusing on
is_default_constructible (or other such traits) alone provides less
information and may be insufficient. It should be used only, if the
situation allows this (e.g. for very simple wrapper types such as
pair/tuple, maybe optional) or if expressing the remaining
requirements by additional text can be done easily. The traits were
also very much useful compared to the actual textual requirement set,
if a wrapper has to support *both* reference types and object types
(pair/tuple). While there was an attempt to make the textual
requirements work with references, this approach looks broken to me,
see also
http://cplusplus.github.io/LWG/lwg-active.html#2146
- Daniel
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
.