labath added a comment.
I suppose we could create a new class (I am not sure what a good name for that
would be... `OptionalDuration`, which inherits from `llvm:Optional`, but
provides the additional conversion operator to make things work seamlessly.
Something like:
template<typename Ratio>
class OptionalDur<Ratio>: public llvm::Optional<std::chrono::duration<Ratio>>
{
template<typename Ratio2, typename =
std::enable_if<std::is_convertible<duration<Ratio2>, duration<Ratio>>>::type>
OptionalDur(OptionalDur<Ratio2> other) { ...}
};
It will be a bunch of template-fu, but it can be made to work. What do you
think? (I am also open to other ideas on how to implement this....)
For the formatting, I am not sure what it would take to make Optional use a
union, but I can certainly make a data formatter for it. I've been planning to
dig into that area soon anyway...
================
Comment at:
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:125
PacketResult packet_result = PacketResult::Success;
- const uint32_t timeout_usec = 10 * 1000; // Wait for 10 ms for a response
+ const std::chrono::microseconds timeout(10000); // 10 ms
while (packet_result == PacketResult::Success)
----------------
clayborg wrote:
> Can't we do:
>
> ```
> const std::chrono::milliseconds timeout(10);
> ```
>
> Or is this what you mentioned with the llvm::Optional stuff in your
> description?
Yes, that's exactly what I meant.
https://reviews.llvm.org/D26971
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits