From ce07f8f6317dd5cca0607eec0b496c21845637af Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Mon, 13 Jan 2025 13:29:59 -0500 Subject: [PATCH] Fix modernize-type-traits lints (#3339) --- cpp/include/DataStorm/DataStorm.h | 3 +-- cpp/include/DataStorm/InternalT.h | 8 ++++---- cpp/include/Ice/Communicator.h | 4 ++-- cpp/include/Ice/Comparable.h | 12 ++++++------ cpp/include/Ice/Connection.h | 2 +- cpp/include/Ice/InputStream.h | 9 ++++----- cpp/include/Ice/LoggerUtil.h | 2 +- cpp/include/Ice/MetricsObserverI.h | 2 +- cpp/include/Ice/ObjectAdapter.h | 14 +++++++------- cpp/include/Ice/OutputStream.h | 13 ++++++------- cpp/include/Ice/Proxy.h | 4 ++-- cpp/include/Ice/ProxyFunctions.h | 20 ++++++++++---------- cpp/include/Ice/StreamableTraits.h | 12 ++++-------- 13 files changed, 49 insertions(+), 56 deletions(-) diff --git a/cpp/include/DataStorm/DataStorm.h b/cpp/include/DataStorm/DataStorm.h index ee6a8b8692f..e032fdf4f54 100644 --- a/cpp/include/DataStorm/DataStorm.h +++ b/cpp/include/DataStorm/DataStorm.h @@ -1865,8 +1865,7 @@ namespace DataStorm }; /** @private */ - template - struct RegexFilter::value>::type> + template struct RegexFilter::value>> { template static void add(F factory) { diff --git a/cpp/include/DataStorm/InternalT.h b/cpp/include/DataStorm/InternalT.h index 1fa73dfe275..b3c509c2082 100644 --- a/cpp/include/DataStorm/InternalT.h +++ b/cpp/include/DataStorm/InternalT.h @@ -60,7 +60,7 @@ namespace DataStormI } }; - template struct EncoderT::value>::type> + template struct EncoderT::value>> { static Ice::ByteSeq encode(const Ice::CommunicatorPtr& communicator, const T& value) { @@ -68,7 +68,7 @@ namespace DataStormI } }; - template struct DecoderT::value>::type> + template struct DecoderT::value>> { static T decode(const Ice::CommunicatorPtr& communicator, const Ice::ByteSeq& data) { @@ -97,7 +97,7 @@ namespace DataStormI } }; - template struct Stringifier::value>::type> + template struct Stringifier::value>> { static std::string toString(const T& value) { @@ -481,7 +481,7 @@ namespace DataStormI template class FilterManagerT final : public FilterManager { - using Value = typename std::remove_reference().get())>::type; + using Value = std::remove_reference_t().get())>; struct Factory { diff --git a/cpp/include/Ice/Communicator.h b/cpp/include/Ice/Communicator.h index 0b1e9355908..054d0adedd9 100644 --- a/cpp/include/Ice/Communicator.h +++ b/cpp/include/Ice/Communicator.h @@ -83,7 +83,7 @@ namespace Ice * @return The proxy, or nullopt if str is an empty string. * @see #proxyToString */ - template::value, bool> = true> + template, bool> = true> std::optional stringToProxy(std::string_view str) const { auto reference = _stringToProxy(str); @@ -115,7 +115,7 @@ namespace Ice * @param property The base property name. * @return The proxy, or nullopt if the property is not set. */ - template::value, bool> = true> + template, bool> = true> std::optional propertyToProxy(std::string_view property) const { auto reference = _propertyToProxy(property); diff --git a/cpp/include/Ice/Comparable.h b/cpp/include/Ice/Comparable.h index c2322564240..131ae93069a 100644 --- a/cpp/include/Ice/Comparable.h +++ b/cpp/include/Ice/Comparable.h @@ -125,7 +125,7 @@ namespace Ice template< class C, std::enable_if_t< - std::is_member_function_pointer::value && !std::is_polymorphic_v, + std::is_member_function_pointer_v && !std::is_polymorphic_v, bool> = true> bool operator<(const C& lhs, const C& rhs) { @@ -141,7 +141,7 @@ namespace Ice template< class C, std::enable_if_t< - std::is_member_function_pointer::value && !std::is_polymorphic_v, + std::is_member_function_pointer_v && !std::is_polymorphic_v, bool> = true> bool operator<=(const C& lhs, const C& rhs) { @@ -157,7 +157,7 @@ namespace Ice template< class C, std::enable_if_t< - std::is_member_function_pointer::value && !std::is_polymorphic_v, + std::is_member_function_pointer_v && !std::is_polymorphic_v, bool> = true> bool operator>(const C& lhs, const C& rhs) { @@ -173,7 +173,7 @@ namespace Ice template< class C, std::enable_if_t< - std::is_member_function_pointer::value && !std::is_polymorphic_v, + std::is_member_function_pointer_v && !std::is_polymorphic_v, bool> = true> bool operator>=(const C& lhs, const C& rhs) { @@ -189,7 +189,7 @@ namespace Ice template< class C, std::enable_if_t< - std::is_member_function_pointer::value && !std::is_polymorphic_v, + std::is_member_function_pointer_v && !std::is_polymorphic_v, bool> = true> bool operator==(const C& lhs, const C& rhs) { @@ -205,7 +205,7 @@ namespace Ice template< class C, std::enable_if_t< - std::is_member_function_pointer::value && !std::is_polymorphic_v, + std::is_member_function_pointer_v && !std::is_polymorphic_v, bool> = true> bool operator!=(const C& lhs, const C& rhs) { diff --git a/cpp/include/Ice/Connection.h b/cpp/include/Ice/Connection.h index d14185a8490..09286f7316a 100644 --- a/cpp/include/Ice/Connection.h +++ b/cpp/include/Ice/Connection.h @@ -100,7 +100,7 @@ namespace Ice * @return A proxy that matches the given identity and uses this connection. * @see #setAdapter */ - template::value, bool> = true> + template, bool> = true> [[nodiscard]] Prx createProxy(Identity id) const { return uncheckedCast(_createProxy(std::move(id))); diff --git a/cpp/include/Ice/InputStream.h b/cpp/include/Ice/InputStream.h index 631fab3abb3..35e77e561f0 100644 --- a/cpp/include/Ice/InputStream.h +++ b/cpp/include/Ice/InputStream.h @@ -380,7 +380,7 @@ namespace Ice * @param tag The tag ID. * @param v Holds the extracted data (if any). */ - template::value, bool> = true> + template, bool> = true> void read(std::int32_t tag, std::optional& v) { if (readOptional( @@ -404,7 +404,7 @@ namespace Ice * was set to nullopt (set to nullopt is supported for backward compatibility with Ice 3.7 and earlier * releases). */ - template::value, bool> = true> + template, bool> = true> void read(std::int32_t tag, std::optional& v) { if (readOptional(tag, OptionalFormat::FSize)) @@ -666,7 +666,7 @@ namespace Ice * Reads a typed proxy from the stream. * @param v The proxy as a user-defined type. */ - template::value, bool> = true> + template, bool> = true> void read(std::optional& v) { IceInternal::ReferencePtr ref = readReference(); @@ -684,8 +684,7 @@ namespace Ice * Reads a value (instance of a Slice class) from the stream (New mapping). * @param v The instance. */ - template::value>::type* = nullptr> - void read(std::shared_ptr& v) + template>* = nullptr> void read(std::shared_ptr& v) { read(patchValue, &v); } diff --git a/cpp/include/Ice/LoggerUtil.h b/cpp/include/Ice/LoggerUtil.h index e2064093c60..ffb17701d1e 100644 --- a/cpp/include/Ice/LoggerUtil.h +++ b/cpp/include/Ice/LoggerUtil.h @@ -71,7 +71,7 @@ namespace Ice return LoggerOutputInserter::value>::insert(out, val); } - template::value, bool> = true> + template, bool> = true> inline LoggerOutputBase& operator<<(LoggerOutputBase& os, const std::optional& p) { return os << (p ? p->ice_toString() : ""); diff --git a/cpp/include/Ice/MetricsObserverI.h b/cpp/include/Ice/MetricsObserverI.h index 3f5bad14805..401879a0b1c 100644 --- a/cpp/include/Ice/MetricsObserverI.h +++ b/cpp/include/Ice/MetricsObserverI.h @@ -274,7 +274,7 @@ namespace IceMX static const std::string toString(const Ice::ObjectPrx& p) { return p->ice_toString(); } - template::value, bool> = true> + template, bool> = true> static const std::string toString(const std::optional& p) { return p ? toString(p.value()) : ""; diff --git a/cpp/include/Ice/ObjectAdapter.h b/cpp/include/Ice/ObjectAdapter.h index 07ddfed1c41..dc4810e3393 100644 --- a/cpp/include/Ice/ObjectAdapter.h +++ b/cpp/include/Ice/ObjectAdapter.h @@ -132,7 +132,7 @@ namespace Ice * @see #remove * @see #find */ - template::value, bool> = true> + template, bool> = true> Prx add(const ObjectPtr& servant, const Identity& id) { return uncheckedCast(_add(servant, id)); @@ -151,7 +151,7 @@ namespace Ice * @see #removeFacet * @see #findFacet */ - template::value, bool> = true> + template, bool> = true> Prx addFacet(ObjectPtr servant, Identity id, std::string facet) { return uncheckedCast(_addFacet(std::move(servant), std::move(id), std::move(facet))); @@ -169,7 +169,7 @@ namespace Ice * @see #remove * @see #find */ - template::value, bool> = true> + template, bool> = true> Prx addWithUUID(ObjectPtr servant) { return uncheckedCast(_addWithUUID(std::move(servant))); @@ -188,7 +188,7 @@ namespace Ice * @see #removeFacet * @see #findFacet */ - template::value, bool> = true> + template, bool> = true> Prx addFacetWithUUID(ObjectPtr servant, std::string facet) { return uncheckedCast(_addFacetWithUUID(std::move(servant), std::move(facet))); @@ -379,7 +379,7 @@ namespace Ice * @return A proxy for the object with the given identity. * @see Identity */ - template::value, bool> = true> + template, bool> = true> Prx createProxy(Identity id) { return uncheckedCast(_createProxy(std::move(id))); @@ -392,7 +392,7 @@ namespace Ice * @return A proxy for the object with the given identity. * @see Identity */ - template::value, bool> = true> + template, bool> = true> Prx createDirectProxy(Identity id) { return uncheckedCast(_createDirectProxy(std::move(id))); @@ -406,7 +406,7 @@ namespace Ice * @return A proxy for the object with the given identity. * @see Identity */ - template::value, bool> = true> + template, bool> = true> Prx createIndirectProxy(Identity id) { return uncheckedCast(_createIndirectProxy(std::move(id))); diff --git a/cpp/include/Ice/OutputStream.h b/cpp/include/Ice/OutputStream.h index e289b1e8435..e76fa0353ce 100644 --- a/cpp/include/Ice/OutputStream.h +++ b/cpp/include/Ice/OutputStream.h @@ -340,7 +340,7 @@ namespace Ice * @param tag The tag ID. * @param v The data value to be written (if any). */ - template::value, bool> = true> + template, bool> = true> void write(std::int32_t tag, const std::optional& v) { if (!v) @@ -362,7 +362,7 @@ namespace Ice * @param tag The tag ID. * @param v The proxy to be written (if any). */ - template::value, bool> = true> + template, bool> = true> void write(std::int32_t tag, const std::optional& v) { if (!v) @@ -425,8 +425,7 @@ namespace Ice /** * Writes a list of mandatory data values. */ - template - typename std::enable_if::type writeAll(std::tuple) + template std::enable_if_t writeAll(std::tuple) { // Do nothing. Either tuple is empty or we are at the end. } @@ -435,7 +434,7 @@ namespace Ice * Writes a list of mandatory data values. */ template - typename std::enable_if < I::type writeAll(std::tuple tuple) + std::enable_if_t < I writeAll(std::tuple tuple) { write(std::get(tuple)); writeAll(tuple); @@ -714,7 +713,7 @@ namespace Ice * Writes a proxy to the stream. * @param v The proxy to be write. */ - template::value, bool> = true> + template, bool> = true> void write(const std::optional& v) { if (v) @@ -731,7 +730,7 @@ namespace Ice * Writes a value instance to the stream. * @param v The value to be written. */ - template::value>::type* = nullptr> + template>* = nullptr> void write(const std::shared_ptr& v) { initEncaps(); diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index 4af0a7f80e1..307b060a3d2 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -631,7 +631,7 @@ namespace Ice * @param id The identity for the new proxy. * @return A proxy with the new identity. */ - template::value, bool> = true> + template, bool> = true> [[nodiscard]] Prx ice_identity(Ice::Identity id) const { return Prx::_fromReference(_identity(std::move(id))); @@ -654,7 +654,7 @@ namespace Ice * @param facet The facet for the new proxy. * @return A proxy with the new facet. */ - template::value, bool> = true> + template, bool> = true> [[nodiscard]] Prx ice_facet(std::string facet) const { return Prx::_fromReference(_facet(std::move(facet))); diff --git a/cpp/include/Ice/ProxyFunctions.h b/cpp/include/Ice/ProxyFunctions.h index 01cf42ba099..e3c7e6c40b1 100644 --- a/cpp/include/Ice/ProxyFunctions.h +++ b/cpp/include/Ice/ProxyFunctions.h @@ -24,7 +24,7 @@ namespace Ice * @param current The Current object for the invocation. * @throw MarshalException If the proxy is null. * */ - template::value, bool> = true> + template, bool> = true> void checkNotNull(std::optional prx, const char* file, int line, const Current& current) { if (!prx) @@ -41,7 +41,7 @@ namespace Ice * @remark The preferred syntax is to construct the proxy from another proxy using the explicit ObjectPrx * constructor. */ - template::value, bool> = true> + template, bool> = true> Prx uncheckedCast(const ObjectPrx& proxy) { return Prx::_fromReference(proxy._getReference()); @@ -54,7 +54,7 @@ namespace Ice * @remark The preferred syntax is to construct the proxy from another proxy using the explicit ObjectPrx * constructor. */ - template::value, bool> = true> + template, bool> = true> std::optional uncheckedCast(const std::optional& proxy) { if (proxy) @@ -73,7 +73,7 @@ namespace Ice * @param facet A facet name. * @return A proxy with the requested type and facet. */ - template::value, bool> = true> + template, bool> = true> Prx uncheckedCast(const ObjectPrx& proxy, std::string facet) { return uncheckedCast(proxy->ice_facet(std::move(facet))); @@ -85,7 +85,7 @@ namespace Ice * @param facet A facet name. * @return A proxy with the requested type and facet. */ - template::value, bool> = true> + template, bool> = true> std::optional uncheckedCast(const std::optional& proxy, std::string facet) { if (proxy) @@ -104,7 +104,7 @@ namespace Ice * @param context The context map for the invocation. * @return A proxy with the requested type, or nullopt if the target object does not support the requested type. */ - template::value, bool> = true> + template, bool> = true> std::optional checkedCast(const ObjectPrx& proxy, const Context& context = noExplicitContext) { if (proxy->ice_isA(Prx::ice_staticId(), context)) @@ -124,7 +124,7 @@ namespace Ice * @return A proxy with the requested type, or nullopt if the source proxy is nullopt or if the target object does * not support the requested type. */ - template::value, bool> = true> + template, bool> = true> std::optional checkedCast(const std::optional& proxy, const Context& context = noExplicitContext) { return proxy ? checkedCast(proxy.value(), context) : std::nullopt; @@ -138,7 +138,7 @@ namespace Ice * @return A proxy with the requested type and facet, or nullopt if the target facet is not of the requested * type. */ - template::value, bool> = true> + template, bool> = true> std::optional checkedCast(const ObjectPrx& proxy, std::string facet, const Context& context = noExplicitContext) { @@ -153,7 +153,7 @@ namespace Ice * @return A proxy with the requested type and facet, or nullopt if the source proxy is nullopt, or if the target * facet is not of the requested type. */ - template::value, bool> = true> + template, bool> = true> std::optional checkedCast(const std::optional& proxy, std::string facet, const Context& context = noExplicitContext) { @@ -170,7 +170,7 @@ namespace Ice ICE_API std::ostream& operator<<(std::ostream&, const ObjectPrx&); - template::value, bool> = true> + template, bool> = true> inline std::ostream& operator<<(std::ostream& os, const std::optional& proxy) { if (proxy) diff --git a/cpp/include/Ice/StreamableTraits.h b/cpp/include/Ice/StreamableTraits.h index cef315a42db..98153127913 100644 --- a/cpp/include/Ice/StreamableTraits.h +++ b/cpp/include/Ice/StreamableTraits.h @@ -128,8 +128,7 @@ namespace Ice * Specialization for sequence and dictionary types. * \headerfile Ice/Ice.h */ - template - struct StreamableTraits::value || IsContainer::value>::type> + template struct StreamableTraits::value || IsContainer::value>> { static const StreamHelperCategory helper = IsMap::value ? StreamHelperCategoryDictionary : StreamHelperCategorySequence; @@ -141,8 +140,7 @@ namespace Ice * Specialization for exceptions. * \headerfile Ice/Ice.h */ - template - struct StreamableTraits::value>::type> + template struct StreamableTraits>> { static const StreamHelperCategory helper = StreamHelperCategoryUserException; @@ -322,8 +320,7 @@ namespace Ice * Specialization for proxy types. * \headerfile Ice/Ice.h */ - template - struct StreamableTraits, typename std::enable_if::value>::type> + template struct StreamableTraits, std::enable_if_t>> { static const StreamHelperCategory helper = StreamHelperCategoryProxy; static const int minWireSize = 2; @@ -334,8 +331,7 @@ namespace Ice * Specialization for class types. * \headerfile Ice/Ice.h */ - template - struct StreamableTraits, typename std::enable_if::value>::type> + template struct StreamableTraits, std::enable_if_t>> { static const StreamHelperCategory helper = StreamHelperCategoryClass; static const int minWireSize = 1;