diff --git a/src/pvaproto.h b/src/pvaproto.h index f3e82c8..cbe9b95 100644 --- a/src/pvaproto.h +++ b/src/pvaproto.h @@ -192,7 +192,7 @@ inline void _from_wire(Buffer& buf, uint8_t *mem, bool reverse) * @param buf output buffer. buf[0] through buf[sizeof(T)-1] must be valid. * @param val input variable */ -template=2 && std::is_scalar{} && !std::is_pointer{}, int>::type =0> +template=2 && std::is_scalar::value && !std::is_pointer::value, int>::type =0> inline void to_wire(Buffer& buf, const T& val) { union { @@ -203,7 +203,7 @@ inline void to_wire(Buffer& buf, const T& val) _to_wire(buf, pun.b, buf.be ^ hostBE); } -template{}, int>::type =0> +template::value, int>::type =0> inline void to_wire(Buffer& buf, const T& val) { if(!buf.ensure(1)) { diff --git a/src/pvxs/data.h b/src/pvxs/data.h index 2931cb3..8ab70a0 100644 --- a/src/pvxs/data.h +++ b/src/pvxs/data.h @@ -50,17 +50,17 @@ struct StorageMap; // map signed integers to int64_t template -struct StorageMap{} && std::is_signed{}>::type> +struct StorageMap::value && std::is_signed::value>::type> { typedef int64_t store_t; static constexpr StoreType code{StoreType::Integer}; }; // map unsigned integers to uint64_t template -struct StorageMap{} && !std::is_signed{} && !std::is_same{}>::type> +struct StorageMap::value && !std::is_signed::value && !std::is_same::value>::type> { typedef uint64_t store_t; static constexpr StoreType code{StoreType::UInteger}; }; // map floating point to double. (truncates long double, but then PVA doesn't >8 byte primatives anyway support anyway) template -struct StorageMap{}>::type> +struct StorageMap::value>::type> { typedef double store_t; static constexpr StoreType code{StoreType::Real}; }; template<> @@ -623,7 +623,7 @@ public: #ifdef _DOXYGEN_ Value& #else - typename std::enable_if{}, Value&>::type + typename std::enable_if::value, Value&>::type #endif operator=(const T& val) { from(val); diff --git a/src/pvxs/sharedArray.h b/src/pvxs/sharedArray.h index 6a93f11..9a529d2 100644 --- a/src/pvxs/sharedArray.h +++ b/src/pvxs/sharedArray.h @@ -75,7 +75,7 @@ struct sizeofx { static inline size_t op() { return sizeof(T); } }; template -struct sizeofx{}>::type> { +struct sizeofx::value>::type> { static inline size_t op() { return 1u; } // treat void* as pointer to bytes }; @@ -84,14 +84,6 @@ struct sa_default_delete { void operator()(E* e) const { delete[] e; } }; -// use of typename std::enable_if{}>::type -// as enabler for the shared_array<> void specialization below fails with gcc 4.8 and 4.9.. -// The is_void specialization isn't being selected, but no hint is given as to why. -// This older style of enabler works though. Go figure... -template struct is_void {}; -template struct is_void { typedef R type; }; -template struct is_void { typedef R type; }; - template struct sa_base { protected: @@ -440,33 +432,33 @@ public: convertTo() const; #endif - template{} && (std::is_const{} == std::is_const{}), int>::type =0> + template::value && (std::is_const::value == std::is_const::value), int>::type =0> shared_array castTo() const { return shared_array(this->_data, this->_data.get(), this->_count); // implied cast to void* } - template{}, int>::type =0> + template::value, int>::type =0> shared_array castTo() const { return *this; } // static_cast() to non-void, preserving const-ness - template{} && (std::is_const{} == std::is_const{}), int>::type =0> + template::value && (std::is_const::value == std::is_const::value), int>::type =0> shared_array castToUnsafe() const { return shared_array(this->_data, static_cast(this->_data.get()), this->_count); } // static_cast() to void, preserving const-ness - template{} && (std::is_const{} == std::is_const{}), int>::type =0> + template::value && (std::is_const::value == std::is_const::value), int>::type =0> shared_array castToUnsafe() const { return shared_array(this->_data, this->_data.get(), this->_count); // implied cast to void* } - template{} && (std::is_const{} == std::is_const{}), int>::type =0> + template::value && (std::is_const::value == std::is_const::value), int>::type =0> shared_array convertTo() const { if(detail::CaptureBase::code==detail::CaptureBase::code) { @@ -495,7 +487,7 @@ public: template -class shared_array::type > +class shared_array::value>::type > : public detail::sa_base { static_assert (std::is_void::value, "void specialization"); @@ -602,7 +594,7 @@ public: } // static_cast() to non-void, preserving const-ness - template{} && (std::is_const{} == std::is_const{}), int>::type =0> + template::value && (std::is_const::value == std::is_const::value), int>::type =0> shared_array castTo() const { if(this->_data && _type!=detail::CaptureBase::code) { @@ -611,21 +603,21 @@ public: return shared_array(this->_data, static_cast(this->_data.get()), this->_count); } - template{} && (std::is_const{} == std::is_const{}), int>::type =0> + template::value && (std::is_const::value == std::is_const::value), int>::type =0> shared_array castTo() const { return *this; } // static_cast() to non-void, preserving const-ness - template{} && (std::is_const{} == std::is_const{}), int>::type =0> + template::value && (std::is_const::value == std::is_const::value), int>::type =0> shared_array castToUnsafe() const { return shared_array(this->_data, static_cast(this->_data.get()), this->_count); } // static_cast() to void, preserving const-ness - template{} && (std::is_const{} == std::is_const{}), int>::type =0> + template::value && (std::is_const::value == std::is_const::value), int>::type =0> shared_array castToUnsafe() const { // in reality this is either void -> void, or const void -> const void @@ -633,7 +625,7 @@ public: return *this; } - template{} && (std::is_const{} == std::is_const{}), int>::type =0> + template::value && (std::is_const::value == std::is_const::value), int>::type =0> shared_array convertTo() const { if(detail::CaptureBase::code==_type) { @@ -647,7 +639,7 @@ public: } } - template{} && (std::is_const{} == std::is_const{}), int>::type =0> + template::value && (std::is_const::value == std::is_const::value), int>::type =0> shared_array convertTo() const { return castTo(); diff --git a/src/sharedarray.cpp b/src/sharedarray.cpp index 11f97e1..8ec1d81 100644 --- a/src/sharedarray.cpp +++ b/src/sharedarray.cpp @@ -135,7 +135,7 @@ void printValue(std::string& dest, const bool& src) } template -typename std::enable_if{}>::type +typename std::enable_if::value>::type printValue(std::string& dest, const Src& src) { std::ostringstream strm;