Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix modernize-type-traits lints #3339

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cpp/include/DataStorm/DataStorm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1865,8 +1865,7 @@ namespace DataStorm
};

/** @private */
template<typename T, typename V>
struct RegexFilter<T, V, typename std::enable_if<DataStormI::is_streamable<V>::value>::type>
template<typename T, typename V> struct RegexFilter<T, V, std::enable_if_t<DataStormI::is_streamable<V>::value>>
{
template<typename F> static void add(F factory)
{
Expand Down
8 changes: 4 additions & 4 deletions cpp/include/DataStorm/InternalT.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ namespace DataStormI
}
};

template<typename T> struct EncoderT<T, typename std::enable_if<has_communicator_parameter<T>::value>::type>
template<typename T> struct EncoderT<T, std::enable_if_t<has_communicator_parameter<T>::value>>
{
static Ice::ByteSeq encode(const Ice::CommunicatorPtr& communicator, const T& value)
{
return DataStorm::Encoder<T>::encode(communicator, value);
}
};

template<typename T> struct DecoderT<T, typename std::enable_if<has_communicator_parameter<T>::value>::type>
template<typename T> struct DecoderT<T, std::enable_if_t<has_communicator_parameter<T>::value>>
{
static T decode(const Ice::CommunicatorPtr& communicator, const Ice::ByteSeq& data)
{
Expand Down Expand Up @@ -97,7 +97,7 @@ namespace DataStormI
}
};

template<typename T> struct Stringifier<T, typename std::enable_if<is_streamable<T>::value>::type>
template<typename T> struct Stringifier<T, std::enable_if_t<is_streamable<T>::value>>
{
static std::string toString(const T& value)
{
Expand Down Expand Up @@ -481,7 +481,7 @@ namespace DataStormI

template<typename ValueT> class FilterManagerT final : public FilterManager
{
using Value = typename std::remove_reference<decltype(std::declval<ValueT>().get())>::type;
using Value = std::remove_reference_t<decltype(std::declval<ValueT>().get())>;

struct Factory
{
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/Ice/Communicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace Ice
* @return The proxy, or nullopt if <code>str</code> is an empty string.
* @see #proxyToString
*/
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of<ObjectPrx, Prx>::value, bool> = true>
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
std::optional<Prx> stringToProxy(std::string_view str) const
{
auto reference = _stringToProxy(str);
Expand Down Expand Up @@ -115,7 +115,7 @@ namespace Ice
* @param property The base property name.
* @return The proxy, or nullopt if the property is not set.
*/
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of<ObjectPrx, Prx>::value, bool> = true>
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
std::optional<Prx> propertyToProxy(std::string_view property) const
{
auto reference = _propertyToProxy(property);
Expand Down
12 changes: 6 additions & 6 deletions cpp/include/Ice/Comparable.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ namespace Ice
template<
class C,
std::enable_if_t<
std::is_member_function_pointer<decltype(&C::ice_tuple)>::value && !std::is_polymorphic_v<C>,
std::is_member_function_pointer_v<decltype(&C::ice_tuple)> && !std::is_polymorphic_v<C>,
bool> = true>
bool operator<(const C& lhs, const C& rhs)
{
Expand All @@ -141,7 +141,7 @@ namespace Ice
template<
class C,
std::enable_if_t<
std::is_member_function_pointer<decltype(&C::ice_tuple)>::value && !std::is_polymorphic_v<C>,
std::is_member_function_pointer_v<decltype(&C::ice_tuple)> && !std::is_polymorphic_v<C>,
bool> = true>
bool operator<=(const C& lhs, const C& rhs)
{
Expand All @@ -157,7 +157,7 @@ namespace Ice
template<
class C,
std::enable_if_t<
std::is_member_function_pointer<decltype(&C::ice_tuple)>::value && !std::is_polymorphic_v<C>,
std::is_member_function_pointer_v<decltype(&C::ice_tuple)> && !std::is_polymorphic_v<C>,
bool> = true>
bool operator>(const C& lhs, const C& rhs)
{
Expand All @@ -173,7 +173,7 @@ namespace Ice
template<
class C,
std::enable_if_t<
std::is_member_function_pointer<decltype(&C::ice_tuple)>::value && !std::is_polymorphic_v<C>,
std::is_member_function_pointer_v<decltype(&C::ice_tuple)> && !std::is_polymorphic_v<C>,
bool> = true>
bool operator>=(const C& lhs, const C& rhs)
{
Expand All @@ -189,7 +189,7 @@ namespace Ice
template<
class C,
std::enable_if_t<
std::is_member_function_pointer<decltype(&C::ice_tuple)>::value && !std::is_polymorphic_v<C>,
std::is_member_function_pointer_v<decltype(&C::ice_tuple)> && !std::is_polymorphic_v<C>,
bool> = true>
bool operator==(const C& lhs, const C& rhs)
{
Expand All @@ -205,7 +205,7 @@ namespace Ice
template<
class C,
std::enable_if_t<
std::is_member_function_pointer<decltype(&C::ice_tuple)>::value && !std::is_polymorphic_v<C>,
std::is_member_function_pointer_v<decltype(&C::ice_tuple)> && !std::is_polymorphic_v<C>,
bool> = true>
bool operator!=(const C& lhs, const C& rhs)
{
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/Connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace Ice
* @return A proxy that matches the given identity and uses this connection.
* @see #setAdapter
*/
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of<ObjectPrx, Prx>::value, bool> = true>
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
[[nodiscard]] Prx createProxy(Identity id) const
{
return uncheckedCast<Prx>(_createProxy(std::move(id)));
Expand Down
9 changes: 4 additions & 5 deletions cpp/include/Ice/InputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ namespace Ice
* @param tag The tag ID.
* @param v Holds the extracted data (if any).
*/
template<typename T, std::enable_if_t<!std::is_base_of<ObjectPrx, T>::value, bool> = true>
template<typename T, std::enable_if_t<!std::is_base_of_v<ObjectPrx, T>, bool> = true>
void read(std::int32_t tag, std::optional<T>& v)
{
if (readOptional(
Expand All @@ -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<typename T, std::enable_if_t<std::is_base_of<ObjectPrx, T>::value, bool> = true>
template<typename T, std::enable_if_t<std::is_base_of_v<ObjectPrx, T>, bool> = true>
void read(std::int32_t tag, std::optional<T>& v)
{
if (readOptional(tag, OptionalFormat::FSize))
Expand Down Expand Up @@ -666,7 +666,7 @@ namespace Ice
* Reads a typed proxy from the stream.
* @param v The proxy as a user-defined type.
*/
template<typename Prx, std::enable_if_t<std::is_base_of<ObjectPrx, Prx>::value, bool> = true>
template<typename Prx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
void read(std::optional<Prx>& v)
{
IceInternal::ReferencePtr ref = readReference();
Expand All @@ -684,8 +684,7 @@ namespace Ice
* Reads a value (instance of a Slice class) from the stream (New mapping).
* @param v The instance.
*/
template<typename T, typename std::enable_if<std::is_base_of<Value, T>::value>::type* = nullptr>
void read(std::shared_ptr<T>& v)
template<typename T, std::enable_if_t<std::is_base_of_v<Value, T>>* = nullptr> void read(std::shared_ptr<T>& v)
{
read(patchValue<T>, &v);
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/LoggerUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace Ice
return LoggerOutputInserter<T, IsException<T>::value>::insert(out, val);
}

template<typename Prx, std::enable_if_t<std::is_base_of<ObjectPrx, Prx>::value, bool> = true>
template<typename Prx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
inline LoggerOutputBase& operator<<(LoggerOutputBase& os, const std::optional<Prx>& p)
{
return os << (p ? p->ice_toString() : "");
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/MetricsObserverI.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ namespace IceMX

static const std::string toString(const Ice::ObjectPrx& p) { return p->ice_toString(); }

template<typename Prx, std::enable_if_t<std::is_base_of<Ice::ObjectPrx, Prx>::value, bool> = true>
template<typename Prx, std::enable_if_t<std::is_base_of_v<Ice::ObjectPrx, Prx>, bool> = true>
static const std::string toString(const std::optional<Prx>& p)
{
return p ? toString(p.value()) : "";
Expand Down
14 changes: 7 additions & 7 deletions cpp/include/Ice/ObjectAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ namespace Ice
* @see #remove
* @see #find
*/
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of<ObjectPrx, Prx>::value, bool> = true>
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
Prx add(const ObjectPtr& servant, const Identity& id)
{
return uncheckedCast<Prx>(_add(servant, id));
Expand All @@ -151,7 +151,7 @@ namespace Ice
* @see #removeFacet
* @see #findFacet
*/
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of<ObjectPrx, Prx>::value, bool> = true>
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
Prx addFacet(ObjectPtr servant, Identity id, std::string facet)
{
return uncheckedCast<Prx>(_addFacet(std::move(servant), std::move(id), std::move(facet)));
Expand All @@ -169,7 +169,7 @@ namespace Ice
* @see #remove
* @see #find
*/
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of<ObjectPrx, Prx>::value, bool> = true>
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
Prx addWithUUID(ObjectPtr servant)
{
return uncheckedCast<Prx>(_addWithUUID(std::move(servant)));
Expand All @@ -188,7 +188,7 @@ namespace Ice
* @see #removeFacet
* @see #findFacet
*/
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of<ObjectPrx, Prx>::value, bool> = true>
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
Prx addFacetWithUUID(ObjectPtr servant, std::string facet)
{
return uncheckedCast<Prx>(_addFacetWithUUID(std::move(servant), std::move(facet)));
Expand Down Expand Up @@ -379,7 +379,7 @@ namespace Ice
* @return A proxy for the object with the given identity.
* @see Identity
*/
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of<ObjectPrx, Prx>::value, bool> = true>
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
Prx createProxy(Identity id)
{
return uncheckedCast<Prx>(_createProxy(std::move(id)));
Expand All @@ -392,7 +392,7 @@ namespace Ice
* @return A proxy for the object with the given identity.
* @see Identity
*/
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of<ObjectPrx, Prx>::value, bool> = true>
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
Prx createDirectProxy(Identity id)
{
return uncheckedCast<Prx>(_createDirectProxy(std::move(id)));
Expand All @@ -406,7 +406,7 @@ namespace Ice
* @return A proxy for the object with the given identity.
* @see Identity
*/
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of<ObjectPrx, Prx>::value, bool> = true>
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
Prx createIndirectProxy(Identity id)
{
return uncheckedCast<Prx>(_createIndirectProxy(std::move(id)));
Expand Down
13 changes: 6 additions & 7 deletions cpp/include/Ice/OutputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ namespace Ice
* @param tag The tag ID.
* @param v The data value to be written (if any).
*/
template<typename T, std::enable_if_t<!std::is_base_of<ObjectPrx, T>::value, bool> = true>
template<typename T, std::enable_if_t<!std::is_base_of_v<ObjectPrx, T>, bool> = true>
void write(std::int32_t tag, const std::optional<T>& v)
{
if (!v)
Expand All @@ -362,7 +362,7 @@ namespace Ice
* @param tag The tag ID.
* @param v The proxy to be written (if any).
*/
template<typename T, std::enable_if_t<std::is_base_of<ObjectPrx, T>::value, bool> = true>
template<typename T, std::enable_if_t<std::is_base_of_v<ObjectPrx, T>, bool> = true>
void write(std::int32_t tag, const std::optional<T>& v)
{
if (!v)
Expand Down Expand Up @@ -425,8 +425,7 @@ namespace Ice
/**
* Writes a list of mandatory data values.
*/
template<size_t I = 0, typename... Te>
typename std::enable_if<I == sizeof...(Te), void>::type writeAll(std::tuple<Te...>)
template<size_t I = 0, typename... Te> std::enable_if_t<I == sizeof...(Te), void> writeAll(std::tuple<Te...>)
{
// Do nothing. Either tuple is empty or we are at the end.
}
Expand All @@ -435,7 +434,7 @@ namespace Ice
* Writes a list of mandatory data values.
*/
template<size_t I = 0, typename... Te>
typename std::enable_if < I<sizeof...(Te), void>::type writeAll(std::tuple<Te...> tuple)
std::enable_if_t < I<sizeof...(Te), void> writeAll(std::tuple<Te...> tuple)
{
write(std::get<I>(tuple));
writeAll<I + 1, Te...>(tuple);
Expand Down Expand Up @@ -714,7 +713,7 @@ namespace Ice
* Writes a proxy to the stream.
* @param v The proxy to be write.
*/
template<typename Prx, std::enable_if_t<std::is_base_of<ObjectPrx, Prx>::value, bool> = true>
template<typename Prx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
void write(const std::optional<Prx>& v)
{
if (v)
Expand All @@ -731,7 +730,7 @@ namespace Ice
* Writes a value instance to the stream.
* @param v The value to be written.
*/
template<typename T, typename std::enable_if<std::is_base_of<Value, T>::value>::type* = nullptr>
template<typename T, std::enable_if_t<std::is_base_of_v<Value, T>>* = nullptr>
void write(const std::shared_ptr<T>& v)
{
initEncaps();
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/Ice/Proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ namespace Ice
* @param id The identity for the new proxy.
* @return A proxy with the new identity.
*/
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of<ObjectPrx, Prx>::value, bool> = true>
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
[[nodiscard]] Prx ice_identity(Ice::Identity id) const
{
return Prx::_fromReference(_identity(std::move(id)));
Expand All @@ -654,7 +654,7 @@ namespace Ice
* @param facet The facet for the new proxy.
* @return A proxy with the new facet.
*/
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of<ObjectPrx, Prx>::value, bool> = true>
template<typename Prx = ObjectPrx, std::enable_if_t<std::is_base_of_v<ObjectPrx, Prx>, bool> = true>
[[nodiscard]] Prx ice_facet(std::string facet) const
{
return Prx::_fromReference(_facet(std::move(facet)));
Expand Down
Loading
Loading