From: Nicholas Ormrod Date: Wed, 29 Oct 2014 20:03:02 +0000 (-0700) Subject: operator bool() X-Git-Tag: v0.22.0~231 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9a88e5b5681dfc13a5f392ebce9ff2576e476f99;p=folly.git operator bool() Summary: Among all of the implicit conversions, conversion to bool is particularly tricky. For this reason, it has a special call-out in flint among the casts, and canno be overriden. However, there are legitimate use cases for operator bool. In this case, we have a iterator that logically represents a bool but in practice represents a packed integral. This class needs to be implicitly convertible to bool, and warrants an override. Push blocking tests have had over a day to complete, but haven't. Further, the folly change is comment-only. Test Plan: Build flint, run it on BitIteratorDetail.h, see no more lint errors Reviewed By: andrei.alexandrescu@fb.com Subscribers: sdwilsh, louisk, njormrod, folly-diffs@ FB internal diff: D1644141 Tasks: 5486739 Signature: t1:1644141:1414607351:29740da758b75187f4f7b6b5a5ad28a523e7080d --- diff --git a/folly/detail/BitIteratorDetail.h b/folly/detail/BitIteratorDetail.h index eb8edcd6..34ccb4bc 100644 --- a/folly/detail/BitIteratorDetail.h +++ b/folly/detail/BitIteratorDetail.h @@ -36,7 +36,7 @@ class BitReference { public: BitReference(Ref r, size_t bit) : ref_(r), bit_(bit) { } - operator bool() const { + /* implicit */ operator bool() const { return ref_ & (one_ << bit_); }