Add MFBT_EXPLICIT_CONVERSION_OPERATOR

RESOLVED FIXED in mozilla31

Status

()

defect
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: bjacob, Assigned: bjacob)

Tracking

Trunk
mozilla31
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

I need this for something specific, which I'll file and make depend on this.
Attachment #8395793 - Flags: review?(jwalden+bmo)
Blocks: 987290
Comment on attachment 8395793 [details] [diff] [review]
MOZ_EXPLICIT_CONVERSION_OPERATOR

Review of attachment 8395793 [details] [diff] [review]:
-----------------------------------------------------------------

::: mfbt/Attributes.h
@@ +133,5 @@
> + * MOZ_EXPLICIT_CONVERSION_OPERATOR is a specifier on a type conversion
> + * overloaded operator that expands to 'explicit' if C++11 explicit conversion
> + * operators are supported, i.e. disallowing implicit conversions using this
> + * conversion operator. If C++11 explicit conversion operators are not supported
> + * then this expands to nothing.

Needs an example by it:

*   template<typename T>
*   class Ptr
*   {
*      T* ptr;
*      MOZ_EXPLICIT_CONVERSION_OPERATOR operator bool() { return ptr != nullptr; }
*   };

Also change the "expands to" language to discuss the *effect* of its expansions, and not what those expansions are.

Not to bikeshed names too hard, but maybe MOZ_EXPLICIT_CONVERSION only?  Users are going to spell out the operator part of this themselves.
Attachment #8395793 - Flags: review?(jwalden+bmo) → review+
https://hg.mozilla.org/mozilla-central/rev/1defae2eeae9
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.