Skip to content
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
2 changes: 1 addition & 1 deletion src/sst/core/baseComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ class SerializeBaseComponentHelper


template <class T>
class serialize_impl<T*, typename std::enable_if<std::is_base_of<SST::BaseComponent, T>::value>::type>
class serialize_impl<T*, std::enable_if_t<std::is_base_of_v<SST::BaseComponent, T>>>
{
template <class A>
friend class serialize;
Expand Down
13 changes: 6 additions & 7 deletions src/sst/core/decimal_fixedpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class decimal_fixedpoint
@param init Initialization value.
*/
template <class T>
decimal_fixedpoint(T init, typename std::enable_if<std::is_unsigned<T>::value>::type* = nullptr)
decimal_fixedpoint(T init, std::enable_if_t<std::is_unsigned_v<T>>* = nullptr)
{
from_uint64(init);
}
Expand All @@ -228,8 +228,7 @@ class decimal_fixedpoint
@param init Initialization value.
*/
template <class T>
decimal_fixedpoint(
T init, typename std::enable_if<std::is_signed<T>::value && std::is_integral<T>::value>::type* = nullptr)
decimal_fixedpoint(T init, std::enable_if_t<std::is_signed_v<T> && std::is_integral_v<T>>* = nullptr)
{
if ( init < 0 ) {
from_uint64(-init);
Expand All @@ -246,7 +245,7 @@ class decimal_fixedpoint
@param init Initialization value.
*/
template <class T>
decimal_fixedpoint(const T init, typename std::enable_if<std::is_floating_point<T>::value>::type* = nullptr)
decimal_fixedpoint(const T init, std::enable_if_t<std::is_floating_point_v<T>>* = nullptr)
{
from_double(init);
}
Expand Down Expand Up @@ -408,7 +407,7 @@ class decimal_fixedpoint
Templated conversion function for unsigned types.
*/
template <typename T>
T convert_to(typename std::enable_if<std::is_unsigned<T>::value>::type* = 0) const
T convert_to(std::enable_if_t<std::is_unsigned_v<T>>* = nullptr) const
{
return static_cast<T>(toUnsignedLong());
}
Expand All @@ -417,7 +416,7 @@ class decimal_fixedpoint
Templated conversion function for signed integral types.
*/
template <typename T>
T convert_to(typename std::enable_if<std::is_signed<T>::value && std::is_integral<T>::value>::type* = 0) const
T convert_to(std::enable_if_t<std::is_signed_v<T> && std::is_integral_v<T>>* = nullptr) const
{
return static_cast<T>(toLong());
}
Expand All @@ -426,7 +425,7 @@ class decimal_fixedpoint
Templated conversion function for floating point types.
*/
template <typename T>
T convert_to(typename std::enable_if<std::is_floating_point<T>::value>::type* = 0) const
T convert_to(std::enable_if_t<std::is_floating_point_v<T>>* = nullptr) const
{
return static_cast<T>(toDouble());
}
Expand Down
16 changes: 8 additions & 8 deletions src/sst/core/eli/attributeInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ class ProvidesAttributes
} // namespace SST

// clang-format off
#define SST_ELI_DOCUMENT_ATTRIBUTES(...) \
static const std::vector<SST::ElementInfoAttribute>& ELI_getAttributes() \
{ \
static std::vector<SST::ElementInfoAttribute> var = { __VA_ARGS__ }; \
auto parent = SST::ELI::GetAttributes< \
typename std::conditional<(__EliDerivedLevel > __EliBaseLevel), __LocalEliBase, __ParentEliBase>::type>::get(); \
SST::ELI::combineEliInfo(var, parent); \
return var; \
#define SST_ELI_DOCUMENT_ATTRIBUTES(...) \
static const std::vector<SST::ElementInfoAttribute>& ELI_getAttributes() \
{ \
static std::vector<SST::ElementInfoAttribute> var = { __VA_ARGS__ }; \
auto parent = SST::ELI::GetAttributes< \
std::conditional_t<(__EliDerivedLevel > __EliBaseLevel), __LocalEliBase, __ParentEliBase>>::get(); \
SST::ELI::combineEliInfo(var, parent); \
return var; \
}
// clang-format on

Expand Down
34 changes: 14 additions & 20 deletions src/sst/core/eli/elementbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,11 @@ struct DerivedBuilder : public Builder<Base, Args...>
Base* create(Args... ctorArgs) override { return Allocator<Base, T>()(std::forward<Args>(ctorArgs)...); }
};

template <class T, class U>
struct is_tuple_constructible : public std::false_type
{};
template <class, class>
inline constexpr bool is_tuple_constructible_v = false;

template <class T, class... Args>
struct is_tuple_constructible<T, std::tuple<Args...>> : public std::is_constructible<T, Args...>
{};
inline constexpr bool is_tuple_constructible_v<T, std::tuple<Args...>> = std::is_constructible_v<T, Args...>;

struct BuilderDatabase
{
Expand Down Expand Up @@ -230,22 +228,22 @@ template <class NewCtor, class OldCtor>
struct ExtendedCtor
{
template <class T>
using is_constructible = typename NewCtor::template is_constructible<T>;
static constexpr bool is_constructible_v = NewCtor::template is_constructible_v<T>;

/**
The derived Ctor can "block" the more abstract Ctor, meaning an object
should only be instantiated as the most derived type. enable_if here
checks if both the derived API and the parent API are still valid
*/
template <class T>
static typename std::enable_if<OldCtor::template is_constructible<T>::value, bool>::type add()
static std::enable_if_t<OldCtor::template is_constructible_v<T>, bool> add()
{
// if abstract, force an allocation to generate meaningful errors
return NewCtor::template add<T>() && OldCtor::template add<T>();
}

template <class T>
static typename std::enable_if<!OldCtor::template is_constructible<T>::value, bool>::type add()
static std::enable_if_t<!OldCtor::template is_constructible_v<T>, bool> add()
{
// if abstract, force an allocation to generate meaningful errors
return NewCtor::template add<T>();
Expand All @@ -262,7 +260,7 @@ template <class Base, class... Args>
struct SingleCtor
{
template <class T>
using is_constructible = std::is_constructible<T, Args...>;
static constexpr bool is_constructible_v = std::is_constructible_v<T, Args...>;

template <class T>
static bool add()
Expand All @@ -283,15 +281,12 @@ template <class Base, class Ctor, class... Ctors>
struct CtorList : public CtorList<Base, Ctors...>
{
template <class T> // if T is constructible with Ctor arguments
using is_constructible = typename std::conditional<
is_tuple_constructible<T, Ctor>::value,
std::true_type, // yes, constructible
typename CtorList<Base, Ctors...>::template is_constructible<T> // not constructible here but maybe later
>::type;
static constexpr bool is_constructible_v =
is_tuple_constructible_v<T, Ctor> // yes, constructible
|| CtorList<Base, Ctors...>::template is_constructible_v<T>; // not constructible here but maybe later

template <class T, int NumValid = 0, class U = T>
static typename std::enable_if<std::is_abstract<U>::value || is_tuple_constructible<U, Ctor>::value, bool>::type
add()
static std::enable_if_t<std::is_abstract_v<U> || is_tuple_constructible_v<U, Ctor>, bool> add()
{
// if abstract, force an allocation to generate meaningful errors
auto* fact = ElementsBuilder<Base, Ctor>::template makeBuilder<U>();
Expand All @@ -300,8 +295,7 @@ struct CtorList : public CtorList<Base, Ctors...>
}

template <class T, int NumValid = 0, class U = T>
static typename std::enable_if<!std::is_abstract<U>::value && !is_tuple_constructible<U, Ctor>::value, bool>::type
add()
static std::enable_if_t<!std::is_abstract_v<U> && !is_tuple_constructible_v<U, Ctor>, bool> add()
{
return CtorList<Base, Ctors...>::template add<T, NumValid>();
}
Expand All @@ -323,8 +317,8 @@ class NoValidConstructorsForDerivedType<0>
template <class Base>
struct CtorList<Base, void>
{
template <class T>
using is_constructible = std::false_type;
template <class>
static constexpr bool is_constructible_v = false;

template <class T, int numValidCtors>
static bool add()
Expand Down
18 changes: 9 additions & 9 deletions src/sst/core/eli/elementinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,15 +420,15 @@ SST_ELI_getTertiaryNumberFromVersion(SST_ELI_element_version_extraction ver)
// this class. Sny local information will overwrite any inherited
// information. See comment for SST_ELI_DECLARE_BASE in elibase.h for
// info on how __EliDerivedLevel is used.
#define SST_ELI_REGISTER_DERIVED(base, cls, lib, name, version, desc) \
[[maybe_unused]] static constexpr int __EliDerivedLevel = \
std::is_same<base, cls>::value ? __EliBaseLevel : __EliBaseLevel + 1; \
static bool ELI_isLoaded() \
{ \
return SST::ELI::InstantiateBuilder<base, cls>::isLoaded() && \
SST::ELI::InstantiateBuilderInfo<base, cls>::isLoaded(); \
} \
SST_ELI_FORCE_INSTANTIATION(base, cls) \
#define SST_ELI_REGISTER_DERIVED(base, cls, lib, name, version, desc) \
[[maybe_unused]] static constexpr int __EliDerivedLevel = \
std::is_same_v<base, cls> ? __EliBaseLevel : __EliBaseLevel + 1; \
static bool ELI_isLoaded() \
{ \
return SST::ELI::InstantiateBuilder<base, cls>::isLoaded() && \
SST::ELI::InstantiateBuilderInfo<base, cls>::isLoaded(); \
} \
SST_ELI_FORCE_INSTANTIATION(base, cls) \
SST_ELI_DEFAULT_INFO(lib, name, ELI_FORWARD_AS_ONE(version), desc)

#define SST_ELI_REGISTER_EXTERN(base, cls) \
Expand Down
16 changes: 8 additions & 8 deletions src/sst/core/eli/paramsInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ class ProvidesParams
} // namespace SST

// clang-format off
#define SST_ELI_DOCUMENT_PARAMS(...) \
static const std::vector<SST::ElementInfoParam>& ELI_getParams() \
{ \
static std::vector<SST::ElementInfoParam> var = { __VA_ARGS__ }; \
auto parent = SST::ELI::GetParams< \
typename std::conditional<(__EliDerivedLevel > __EliBaseLevel), __LocalEliBase, __ParentEliBase>::type>::get(); \
SST::ELI::combineEliInfo(var, parent); \
return var; \
#define SST_ELI_DOCUMENT_PARAMS(...) \
static const std::vector<SST::ElementInfoParam>& ELI_getParams() \
{ \
static std::vector<SST::ElementInfoParam> var = { __VA_ARGS__ }; \
auto parent = SST::ELI::GetParams< \
std::conditional_t<(__EliDerivedLevel > __EliBaseLevel), __LocalEliBase, __ParentEliBase>>::get(); \
SST::ELI::combineEliInfo(var, parent); \
return var; \
}
// clang-format on

Expand Down
16 changes: 8 additions & 8 deletions src/sst/core/eli/portsInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ class ProvidesPorts
} // namespace SST

// clang-format off
#define SST_ELI_DOCUMENT_PORTS(...) \
static const std::vector<SST::ElementInfoPort>& ELI_getPorts() \
{ \
static std::vector<SST::ElementInfoPort> var = { __VA_ARGS__ }; \
auto parent = SST::ELI::InfoPorts< \
typename std::conditional<(__EliDerivedLevel > __EliBaseLevel), __LocalEliBase, __ParentEliBase>::type>::get(); \
SST::ELI::combineEliInfo(var, parent); \
return var; \
#define SST_ELI_DOCUMENT_PORTS(...) \
static const std::vector<SST::ElementInfoPort>& ELI_getPorts() \
{ \
static std::vector<SST::ElementInfoPort> var = { __VA_ARGS__ }; \
auto parent = SST::ELI::InfoPorts< \
std::conditional_t<(__EliDerivedLevel > __EliBaseLevel), __LocalEliBase, __ParentEliBase>>::get(); \
SST::ELI::combineEliInfo(var, parent); \
return var; \
}
// clang-format on

Expand Down
16 changes: 8 additions & 8 deletions src/sst/core/eli/profilePointInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ class ProvidesProfilePoints
} // namespace SST

// clang-format off
#define SST_ELI_DOCUMENT_PROFILE_POINTS(...) \
static const std::vector<SST::ElementInfoProfilePoint>& ELI_getProfilePoints() \
{ \
static std::vector<SST::ElementInfoProfilePoint> var = { __VA_ARGS__ }; \
auto parent = SST::ELI::InfoProfilePoints< \
typename std::conditional<(__EliDerivedLevel > __EliBaseLevel), __LocalEliBase, __ParentEliBase>::type>::get(); \
SST::ELI::combineEliInfo(var, parent); \
return var; \
#define SST_ELI_DOCUMENT_PROFILE_POINTS(...) \
static const std::vector<SST::ElementInfoProfilePoint>& ELI_getProfilePoints() \
{ \
static std::vector<SST::ElementInfoProfilePoint> var = { __VA_ARGS__ }; \
auto parent = SST::ELI::InfoProfilePoints< \
std::conditional_t<(__EliDerivedLevel > __EliBaseLevel), __LocalEliBase, __ParentEliBase>>::get(); \
SST::ELI::combineEliInfo(var, parent); \
return var; \
}
// clang-format on
#define SST_ELI_DELETE_PROFILE_POINT(point) \
Expand Down
8 changes: 6 additions & 2 deletions src/sst/core/eli/simpleInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,21 @@ class checkForELI_getSimpleInfoFunction
static bool const value = (sizeof(HasFunction<T>(0)) == sizeof(Match));
};

template <class T, int index, class InfoType>
inline constexpr bool checkForELI_getSimpleInfoFunction_v =
checkForELI_getSimpleInfoFunction<T, index, InfoType>::value;

// Actual functions that use checkForELI_getSimpleInfoFunction class
// to create functions to get the information from the class
template <class T, int index, class InfoType>
typename std::enable_if<checkForELI_getSimpleInfoFunction<T, index, InfoType>::value, const InfoType&>::type
std::enable_if_t<checkForELI_getSimpleInfoFunction_v<T, index, InfoType>, const InfoType&>
ELI_templatedGetSimpleInfo()
{
return T::ELI_getSimpleInfo(SimpleInfoPlaceHolder<index, InfoType>());
}

template <class T, int index, class InfoType>
typename std::enable_if<not checkForELI_getSimpleInfoFunction<T, index, InfoType>::value, const InfoType&>::type
std::enable_if_t<!checkForELI_getSimpleInfoFunction_v<T, index, InfoType>, const InfoType&>
ELI_templatedGetSimpleInfo()
{
static InfoType var;
Expand Down
16 changes: 8 additions & 8 deletions src/sst/core/eli/statsInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ class ProvidesStats
} // namespace SST

// clang-format off
#define SST_ELI_DOCUMENT_STATISTICS(...) \
static const std::vector<SST::ElementInfoStatistic>& ELI_getStatistics() \
{ \
static std::vector<SST::ElementInfoStatistic> var = { __VA_ARGS__ }; \
auto parent = SST::ELI::InfoStats< \
typename std::conditional<(__EliDerivedLevel > __EliBaseLevel), __LocalEliBase, __ParentEliBase>::type>::get(); \
SST::ELI::combineEliInfo(var, parent); \
return var; \
#define SST_ELI_DOCUMENT_STATISTICS(...) \
static const std::vector<SST::ElementInfoStatistic>& ELI_getStatistics() \
{ \
static std::vector<SST::ElementInfoStatistic> var = { __VA_ARGS__ }; \
auto parent = SST::ELI::InfoStats< \
std::conditional_t<(__EliDerivedLevel > __EliBaseLevel), __LocalEliBase, __ParentEliBase>>::get(); \
SST::ELI::combineEliInfo(var, parent); \
return var; \
}
// clang-format on

Expand Down
Loading
Loading