Specifically, I'm suggesting adding:

diff --git a/include/v8.h b/include/v8.h

index b96771ed45..5d5685839a 100644

--- a/include/v8.h

+++ b/include/v8.h

@@ -383,6 +383,18 @@ class MaybeLocal {

     return IsEmpty() ? default_value : Local<S>(val_);

   }

 

+  explicit operator bool() const {

+      return !this->IsEmpty();

+  }

+

+  Local<T> & operator->() {

+      return this->ToLocalChecked();

+  }

+

+  Local<T> operator*() {

+      return this->ToLocalChecked();

+  }

+

  private:

   T* val_;

 };

On Monday, March 5, 2018 at 3:02:11 PM UTC-8, [email protected] wrote:
>
> I'd really like to be able to say:
>
> if (auto result = v8::JSON::Parse(...)) {
>     (*result)->Set(...);
> }
>
> instead of 
>
> if (auto result =  v8::JSON::Parse(...); !result.IsEmpty()) {
>     result.ToLocalChecked()->Set(...);
> }
>
> or worse without '17.  
>
> Is there a technical or policy reason this hasn't/can't be added?  I'd be 
> happy to submit it.
>
> Thank you.
>
> --Zac
>
>
>

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to