This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++14 status.
2197. Specification ofis_[un]signed
unclear for non-arithmetic types
Section: 21.3.6.4 [meta.unary.prop] Status: C++14 Submitter: Daniel Krügler Opened: 2012-10-07 Last modified: 2016-01-28
Priority: Not Prioritized
View other active issues in [meta.unary.prop].
View all other issues in [meta.unary.prop].
View all issues with C++14 status.
Discussion:
The pre-conditions for the trait is_signed
allow for any types as template arguments, including non-arithmetic ones.
is_arithmetic<T>::value && T(-1) < T(0)
looks like real code and so leaves it open whether such argument types would create a well-formed instantiation of the trait template or not. As written this definition would lead to a hard instantiation error for a non-arithmetic type like e.g.
struct S {};
I would suggest that the wording clarifies that the instantiation would be valid for such types as well, by means of a specification that is not an exact code pattern. This also reflects how existing implementations behave.
[2013-03-15 Issues Teleconference]
Moved to Tentatively Ready.
[2013-04-20 Bristol]
Proposed resolution:
This wording is relative to N3376.
Change Table 49 as indicated:
Table 49 — Type property predicates Template Condition Preconditionstemplate <class T>
struct is_signed;
Ifis_arithmetic<T>::value &&
is true, the same result as integral_constant<bool, T(-1) < T(0) >::value
;template <class T>
struct is_unsigned;
Ifis_arithmetic<T>::value &&
is true, the same result as integral_constant<bool, T(0) < T(-1) >::value
;RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4