-
Key: CPP1111-10
-
Legacy Issue Number: 18405
-
Status: closed
-
Source: gmail.com ( daniel.kruegler@gmail.com)
-
Summary:
Given the specification of the class template Fixed provides
operator int64_t () const;
operator long double() const;and
bool operator!() const;
This allows to test some Fixed instantiation within a boolean context as in a useful way as follows:
typedef IDL::Fixed<5,2> F;
{ ... }
F f = ...;
if (!f)
But the similar inverse form
if (f) { ... }will cause an ambiguity error between the two conversion functions to int64_t and long double. User code is required to write the obfuscated form
if (!!f)
{ ... }to realize the same thing. This is unfortunate and there is a simple means to solve this problem: The specification should add
explicit operator bool() const;
to the class template synopsis with the same semantics as negating operator!
-
Reported: CPP11 1.0b2 — Fri, 1 Feb 2013 05:00 GMT
-
Disposition: Resolved — CPP11 1.1
-
Disposition Summary:
Accepting this issue as proposed. Also during the discussion it was proposed to add a
namespace level to_string -
Updated: Fri, 6 Mar 2015 20:58 GMT
CPP1111 — Fixed type mapping should provide (explicit) operator bool
- Key: CPP1111-10
- OMG Task Force: IDL to C++11 1.1 RTF