diff options
author | Derek Mauro <dmauro@google.com> | 2023-04-24 08:39:30 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-04-24 08:40:07 -0700 |
commit | 0b49f8af79989341c6a5d02b6a6ab0c32e64adf0 (patch) | |
tree | 2e15d49f56f4d2b21a90221f75edb080f8b721a2 /absl/synchronization/mutex.h | |
parent | 8bd7178b14ea61972f8b04e9a9352bc4a4666cfb (diff) | |
download | abseil-0b49f8af79989341c6a5d02b6a6ab0c32e64adf0.tar.gz abseil-0b49f8af79989341c6a5d02b6a6ab0c32e64adf0.tar.bz2 abseil-0b49f8af79989341c6a5d02b6a6ab0c32e64adf0.zip |
Mutex: Remove MSVC 2015 workarounds
PiperOrigin-RevId: 526653332
Change-Id: I0a20d4ac636da3f1a930f96e0cdb9275527e4688
Diffstat (limited to 'absl/synchronization/mutex.h')
-rw-r--r-- | absl/synchronization/mutex.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/absl/synchronization/mutex.h b/absl/synchronization/mutex.h index 148fa191..29c049df 100644 --- a/absl/synchronization/mutex.h +++ b/absl/synchronization/mutex.h @@ -695,6 +695,20 @@ class Condition { template<typename T> Condition(bool (*func)(T *), T *arg); + // Same as above, but allows for cases where `arg` comes from a pointer that + // is convertible to the function parameter type `T*` but not an exact match. + // + // For example, the argument might be `X*` but the function takes `const X*`, + // or the argument might be `Derived*` while the function takes `Base*`, and + // so on for cases where the argument pointer can be implicitly converted. + // + // Implementation notes: This constructor overload is required in addition to + // the one above to allow deduction of `T` from `arg` for cases such as where + // a function template is passed as `func`. Also, the dummy `typename = void` + // template parameter exists just to work around a MSVC mangling bug. + template <typename T, typename = void> + Condition(bool (*func)(T *), typename absl::internal::identity<T>::type *arg); + // Templated version for invoking a method that returns a `bool`. // // `Condition(object, &Class::Method)` constructs a `Condition` that evaluates @@ -1023,6 +1037,12 @@ inline Condition::Condition(bool (*func)(T *), T *arg) StoreCallback(func); } +template <typename T, typename> +inline Condition::Condition(bool (*func)(T *), + typename absl::internal::identity<T>::type *arg) + // Just delegate to the overload above. + : Condition(func, arg) {} + template <typename T> inline Condition::Condition(T *object, bool (absl::internal::identity<T>::type::*method)()) |