[PATCH] D98477: [ADT] Add IntrusiveVariant

Whisperity via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 22 03:48:14 PDT 2021


whisperity added a comment.

In D98477#2638731 <https://reviews.llvm.org/D98477#2638731>, @scott.linder wrote:

> I'm glad there is interest from others in the new type, I was worried at first it may be too niche of a use.

At face value, I'd like to use it in D75041 <https://reviews.llvm.org/D75041> in the following context, instead of the tagged union, do have an `Optional<Variant<ConvertingCtor, ConversionOperator>> UserConversion`. 🙂

  enum UserDefinedConversionKind { UDCK_None, UDCK_Ctor, UDCK_Oper };
  
  struct UserDefinedConvertingConstructor {
    const CXXConstructorDecl *Fun;
    QualType ConstructorParameterType;
    QualType UserDefinedType;
  };
  
  struct UserDefinedConversionOperator {
    const CXXConversionDecl *Fun;
    QualType UserDefinedType;
    QualType ConversionOperatorResultType;
  };
  
  /// The details of the user-defined conversion involved, as a tagged union.
  union {
    char None;
    UserDefinedConvertingConstructor UDConvCtor;
    UserDefinedConversionOperator UDConvOp;
  };
  UserDefinedConversionKind UDConvKind;


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98477/new/

https://reviews.llvm.org/D98477



More information about the llvm-commits mailing list