mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Roll forward to cl/318180324
Signed-off-by: Alexey Polyudov <apolyudov@google.com> Change-Id: I71bb49fe74104964088d392b12775ec2a253b1c9
This commit is contained in:
@@ -19,7 +19,8 @@ namespace nearby {
|
||||
template <typename Derived, typename Base>
|
||||
inline Derived down_cast(Base* value) {
|
||||
using DerivedType = typename std::remove_pointer<Derived>::type;
|
||||
static_assert(std::is_base_of<Base, DerivedType>::value);
|
||||
static_assert(std::is_base_of<Base, DerivedType>::value,
|
||||
"incompatible casting");
|
||||
return static_cast<Derived>(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "platform_v2/api/platform.h"
|
||||
#include "platform_v2/public/mutex.h"
|
||||
#include "platform_v2/public/mutex_lock.h"
|
||||
#include "absl/types/any.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
@@ -20,8 +19,7 @@ class AtomicReference;
|
||||
// Platform-based atomic type, for something convertible to std::uint32_t.
|
||||
template <typename T>
|
||||
class AtomicReference<T, std::enable_if_t<sizeof(T) <= sizeof(std::uint32_t) &&
|
||||
std::is_trivially_copyable_v<T>,
|
||||
void>>
|
||||
std::is_trivially_copyable<T>::value>>
|
||||
final {
|
||||
public:
|
||||
using Platform = api::ImplementationPlatform;
|
||||
@@ -42,9 +40,9 @@ class AtomicReference<T, std::enable_if_t<sizeof(T) <= sizeof(std::uint32_t) &&
|
||||
// Atomic type that is using Platform mutex to provide atomicity.
|
||||
// Supports any copyable type.
|
||||
template <typename T>
|
||||
class AtomicReference<T, std::enable_if_t<(sizeof(T) > sizeof(std::uint32_t) ||
|
||||
!std::is_trivially_copyable_v<T>),
|
||||
void>>
|
||||
class AtomicReference<T,
|
||||
std::enable_if_t<(sizeof(T) > sizeof(std::uint32_t) ||
|
||||
!std::is_trivially_copyable<T>::value)>>
|
||||
final {
|
||||
public:
|
||||
explicit AtomicReference(T value) {
|
||||
|
||||
Reference in New Issue
Block a user