Commit 58e4e1b6 authored by Dominik Charousset's avatar Dominik Charousset

apple clang 4.0 compatibility

parent 2b2cf282
...@@ -103,20 +103,20 @@ class primitive_variant { ...@@ -103,20 +103,20 @@ class primitive_variant {
}; };
// use static call dispatching to select member // use static call dispatching to select member
inline auto get(util::pt_token<pt_int8>) -> decltype(i8)& { return i8; } inline std::int8_t& get(util::pt_token<pt_int8>) { return i8; }
inline auto get(util::pt_token<pt_int16>) -> decltype(i16)& { return i16; } inline std::int16_t& get(util::pt_token<pt_int16>) { return i16; }
inline auto get(util::pt_token<pt_int32>) -> decltype(i32)& { return i32; } inline std::int32_t& get(util::pt_token<pt_int32>) { return i32; }
inline auto get(util::pt_token<pt_int64>) -> decltype(i64)& { return i64; } inline std::int64_t& get(util::pt_token<pt_int64>) { return i64; }
inline auto get(util::pt_token<pt_uint8>) -> decltype(u8)& { return u8; } inline std::uint8_t& get(util::pt_token<pt_uint8>) { return u8; }
inline auto get(util::pt_token<pt_uint16>) -> decltype(u16)& { return u16; } inline std::uint16_t& get(util::pt_token<pt_uint16>) { return u16; }
inline auto get(util::pt_token<pt_uint32>) -> decltype(u32)& { return u32; } inline std::uint32_t& get(util::pt_token<pt_uint32>) { return u32; }
inline auto get(util::pt_token<pt_uint64>) -> decltype(u64)& { return u64; } inline std::uint64_t& get(util::pt_token<pt_uint64>) { return u64; }
inline auto get(util::pt_token<pt_float>) -> decltype(fl)& { return fl; } inline float& get(util::pt_token<pt_float>) { return fl; }
inline auto get(util::pt_token<pt_double>) -> decltype(db)& { return db; } inline double& get(util::pt_token<pt_double>) { return db; }
inline auto get(util::pt_token<pt_long_double>) -> decltype(ldb)& { return ldb; } inline long double& get(util::pt_token<pt_long_double>) { return ldb; }
inline auto get(util::pt_token<pt_u8string>) -> decltype(s8)& { return s8; } inline std::string& get(util::pt_token<pt_u8string>) { return s8; }
inline auto get(util::pt_token<pt_u16string>) -> decltype(s16)& { return s16; } inline std::u16string& get(util::pt_token<pt_u16string>) { return s16; }
inline auto get(util::pt_token<pt_u32string>) -> decltype(s32)& { return s32; } inline std::u32string& get(util::pt_token<pt_u32string>) { return s32; }
// get(...) const overload // get(...) const overload
template<primitive_type PT> template<primitive_type PT>
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
namespace { namespace {
constexpr long min_long = std::numeric_limits<long>::min(); inline long min_long() { return std::numeric_limits<long>::min(); }
} // namespace <anonymous> } // namespace <anonymous>
...@@ -53,7 +53,7 @@ void shared_spinlock::lock() { ...@@ -53,7 +53,7 @@ void shared_spinlock::lock() {
//std::this_thread::yield(); //std::this_thread::yield();
v = m_flag.load(); v = m_flag.load();
} }
else if (m_flag.compare_exchange_weak(v, min_long)) { else if (m_flag.compare_exchange_weak(v, min_long())) {
return; return;
} }
// else: next iteration // else: next iteration
...@@ -71,7 +71,7 @@ void shared_spinlock::unlock() { ...@@ -71,7 +71,7 @@ void shared_spinlock::unlock() {
bool shared_spinlock::try_lock() { bool shared_spinlock::try_lock() {
long v = m_flag.load(); long v = m_flag.load();
return (v == 0) ? m_flag.compare_exchange_weak(v, min_long) : false; return (v == 0) ? m_flag.compare_exchange_weak(v, min_long()) : false;
} }
void shared_spinlock::lock_shared() { void shared_spinlock::lock_shared() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment