Codechange: Allow ConvertibleThroughBase types to be used as settings. (#13466)

This commit is contained in:
Peter Nelson
2025-02-04 19:06:37 +00:00
committed by GitHub
parent adc79aca09
commit 603630c1ae
3 changed files with 14 additions and 18 deletions

View File

@@ -21,4 +21,12 @@ concept ConvertibleThroughBase = requires(T const a) {
{ a.base() } noexcept -> std::convertible_to<int64_t>;
};
/**
* Type is convertible to TTo, either directly or through ConvertibleThroughBase.
* @tparam T The type under consideration.
* @tparam TTo The type to convert to.
*/
template <typename T, typename TTo>
concept ConvertibleThroughBaseOrTo = std::is_convertible_v<T, TTo> || ConvertibleThroughBase<T>;
#endif /* CONVERTIBLE_THROUGH_BASE_HPP */

View File

@@ -12,9 +12,6 @@
#include "../3rdparty/fmt/format.h"
/** Non-templated base for #StrongType::Typedef for use with type trait queries. */
struct StrongTypedefBase {};
namespace StrongType {
/**
* Mix-in which makes the new Typedef comparable with itself and its base type.
@@ -147,7 +144,7 @@ namespace StrongType {
* @tparam TProperties A list of mixins to add to the class.
*/
template <typename TBaseType, typename TTag, typename... TProperties>
struct EMPTY_BASES Typedef : public StrongTypedefBase, public TProperties::template mixin<Typedef<TBaseType, TTag, TProperties...>, TBaseType>... {
struct EMPTY_BASES Typedef : public TProperties::template mixin<Typedef<TBaseType, TTag, TProperties...>, TBaseType>... {
using BaseType = TBaseType;
constexpr Typedef() = default;