Friendlier error messages from data unit classes.
By explicitly checking that the template argument is arithmetic, we avoid exposing internal implementation details in the error message. Bug: webrtc:9709 Change-Id: Ib1c4b46076af36fe0c4aead968487bb441d03b9a Reviewed-on: https://webrtc-review.googlesource.com/c/112422 Commit-Queue: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25853}
This commit is contained in:
committed by
Commit Bot
parent
286ee0123e
commit
0c3f4d3709
@ -46,14 +46,17 @@ class TimeDelta final : public rtc_units_impl::RelativeUnit<TimeDelta> {
|
||||
}
|
||||
template <typename T>
|
||||
static TimeDelta seconds(T seconds) {
|
||||
static_assert(std::is_arithmetic<T>::value, "");
|
||||
return FromFraction<1000000>(seconds);
|
||||
}
|
||||
template <typename T>
|
||||
static TimeDelta ms(T milliseconds) {
|
||||
static_assert(std::is_arithmetic<T>::value, "");
|
||||
return FromFraction<1000>(milliseconds);
|
||||
}
|
||||
template <typename T>
|
||||
static TimeDelta us(T microseconds) {
|
||||
static_assert(std::is_arithmetic<T>::value, "");
|
||||
return FromValue(microseconds);
|
||||
}
|
||||
template <typename T = int64_t>
|
||||
|
||||
Reference in New Issue
Block a user