[Lldb-commits] [PATCH] D51557: Replace uses of LazyBool with LazyBool template

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 31 14:08:49 PDT 2018


zturner added a comment.

Also I think it doesn't need to be specific to member variables.  We could just have

  template <typename T> class Lazy {
    std::function<T()> Update;
    Optional<T> Value;
  public:
    LazyValue(std::function<T()> Update) : Update(std::move(Update)) {}
  };

Then, to get the same member functionality, you could just say:

  struct Foo {
    Foo() : LazyBool([this]() { return expensiveComputeBool(); }) {}
  
    Lazy<bool>  LazyBool;
  
    bool expensiveComputeBool();
  };


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D51557





More information about the lldb-commits mailing list