X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FADT%2FOptional.h;h=d9acaf6d23b00d8d729db9ccbce596e436e9b647;hp=855ab890392ee26e103e36f7aee3b469c15c7176;hb=116832190dc04f511dacff847742733cc957d46a;hpb=3c8ad803340edbbcf39cc4a40e5163ad0b71cb25 diff --git a/include/llvm/ADT/Optional.h b/include/llvm/ADT/Optional.h index 855ab890392..d9acaf6d23b 100644 --- a/include/llvm/ADT/Optional.h +++ b/include/llvm/ADT/Optional.h @@ -159,6 +159,25 @@ template struct isPodLike > { template void operator==(const Optional &X, const Optional &Y); +template +bool operator==(const Optional &X, NoneType) { + return !X.hasValue(); +} + +template +bool operator==(NoneType, const Optional &X) { + return X == None; +} + +template +bool operator!=(const Optional &X, NoneType) { + return !(X == None); +} + +template +bool operator!=(NoneType, const Optional &X) { + return X != None; +} /// \brief Poison comparison between two \c Optional objects. Clients needs to /// explicitly compare the underlying values and account for empty \c Optional /// objects.