Roll forward to cl/318180324

Signed-off-by: Alexey Polyudov <apolyudov@google.com>
Change-Id: I71bb49fe74104964088d392b12775ec2a253b1c9
This commit is contained in:
Alexey Polyudov
2020-06-24 18:15:07 -07:00
parent 6b27a508ed
commit a4ef9ee564
22 changed files with 576 additions and 109 deletions
+2 -1
View File
@@ -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);
}
+4 -6
View File
@@ -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) {