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
26 changes: 12 additions & 14 deletions include/rfl/Attribute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,21 @@ struct Attribute {
template <class U>
Attribute(Attribute<U>&& _attr) : value_(_attr.get()) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Attribute(const U& _value) : value_(_value) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Attribute(U&& _value) noexcept : value_(std::forward<U>(_value)) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Attribute(const Attribute<U>& _attr) : value_(_attr.value()) {}

/// Assigns the underlying object to its default value.
template <class U = Type,
typename std::enable_if<std::is_default_constructible_v<U>,
bool>::type = true>
template <class U = Type>
requires std::is_default_constructible_v<U>
Attribute(const Default&) : value_(Type()) {}

~Attribute() = default;
Expand All @@ -75,17 +74,16 @@ struct Attribute {
}

/// Assigns the underlying object.
template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
auto& operator=(const U& _value) {
value_ = _value;
return *this;
}

/// Assigns the underlying object to its default value.
template <class U = Type,
typename std::enable_if<std::is_default_constructible_v<U>,
bool>::type = true>
template <class U = Type>
requires std::is_default_constructible_v<U>
auto& operator=(const Default&) {
value_ = Type();
return *this;
Expand Down
18 changes: 9 additions & 9 deletions include/rfl/Binary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace rfl {

/// Used to define a field in the NamedTuple.
template <class T>
requires std::is_unsigned_v<T>
requires std::is_unsigned_v<T>
struct Binary {
/// The underlying type.
using Type = T;
Expand All @@ -36,16 +36,16 @@ struct Binary {
template <class U>
Binary(Binary<U>&& _other) : value_(_other.get()) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Binary(const U& _value) : value_(_value) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Binary(U&& _value) noexcept : value_(std::forward<U>(_value)) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Binary(const Binary<U>& _other) : value_(_other.value()) {}

Binary(const std::string& _str)
Expand All @@ -69,8 +69,8 @@ struct Binary {
}

/// Assigns the underlying object.
template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
auto& operator=(const U& _value) {
value_ = _value;
return *this;
Expand Down
9 changes: 4 additions & 5 deletions include/rfl/DefaultVal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,16 @@ struct DefaultVal {
}

/// Assigns the underlying object.
template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
auto& operator=(const U& _value) {
value_ = _value;
return *this;
}

/// Assigns the underlying object to its default value.
template <class U = Type,
typename std::enable_if<std::is_default_constructible_v<U>,
bool>::type = true>
template <class U = Type>
requires std::is_default_constructible_v<U>
auto& operator=(const Default&) {
value_ = Type();
return *this;
Expand Down
32 changes: 14 additions & 18 deletions include/rfl/Description.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,22 @@ struct Description {
template <class U>
Description(Description<_description, U>&& _field) : value_(_field.get()) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Description(const U& _value) : value_(_value) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Description(U&& _value) noexcept : value_(std::forward<U>(_value)) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Description(const Description<_description, U>& _field)
: value_(_field.value()) {}

/// Assigns the underlying object to its default value.
template <class U = Type,
typename std::enable_if<std::is_default_constructible_v<U>,
bool>::type = true>
template <class U = Type>
requires std::is_default_constructible_v<U>
Description(const Default&) : value_(Type()) {}

~Description() = default;
Expand Down Expand Up @@ -88,29 +87,26 @@ struct Description {
}

/// Assigns the underlying object.
template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
auto& operator=(const U& _value) {
value_ = _value;
return *this;
}

/// Assigns the underlying object to its default value.
template <class U = Type,
typename std::enable_if<std::is_default_constructible_v<U>,
bool>::type = true>
template <class U = Type>
requires std::is_default_constructible_v<U>
auto& operator=(const Default&) {
value_ = Type();
return *this;
}

/// Assigns the underlying object.
Description& operator=(
const Description& _field) = default;
Description& operator=(const Description& _field) = default;

/// Assigns the underlying object.
Description& operator=(
Description&& _field) = default;
Description& operator=(Description&& _field) = default;

/// Assigns the underlying object.
template <class U>
Expand Down
26 changes: 12 additions & 14 deletions include/rfl/Field.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,21 @@ struct Field {
template <class U>
Field(Field<_name, U>&& _field) : value_(_field.get()) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Field(const U& _value) : value_(_value) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Field(U&& _value) noexcept : value_(std::forward<U>(_value)) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Field(const Field<_name, U>& _field) : value_(_field.value()) {}

/// Assigns the underlying object to its default value.
template <class U = Type,
typename std::enable_if<std::is_default_constructible_v<U>,
bool>::type = true>
template <class U = Type>
requires std::is_default_constructible_v<U>
Field(const Default&) : value_(Type()) {}

~Field() = default;
Expand Down Expand Up @@ -84,17 +83,16 @@ struct Field {
}

/// Assigns the underlying object.
template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
auto& operator=(const U& _value) {
value_ = _value;
return *this;
}

/// Assigns the underlying object to its default value.
template <class U = Type,
typename std::enable_if<std::is_default_constructible_v<U>,
bool>::type = true>
template <class U = Type>
requires std::is_default_constructible_v<U>
auto& operator=(const Default&) {
value_ = Type();
return *this;
Expand Down
12 changes: 6 additions & 6 deletions include/rfl/Flatten.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ struct Flatten {
template <class U>
Flatten(Flatten<U>&& _f) : value_(_f.get()) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Flatten(const U& _value) : value_(_value) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Flatten(U&& _value) : value_(_value) {}

~Flatten() = default;
Expand Down Expand Up @@ -66,8 +66,8 @@ struct Flatten {
}

/// Assigns the underlying object.
template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Flatten& operator=(const U& _value) {
value_ = _value;
return *this;
Expand Down
15 changes: 6 additions & 9 deletions include/rfl/Generic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,14 @@ class RFL_API Generic {

Generic(const ReflectionType& _value);

template <class T,
typename std::enable_if<std::is_convertible_v<T, VariantType>,
bool>::type = true>
template <class T>
requires std::is_convertible_v<T, VariantType>
Generic(const T& _value) {
value_ = _value;
}

template <class T,
typename std::enable_if<std::is_convertible_v<T, VariantType>,
bool>::type = true>
template <class T>
requires std::is_convertible_v<T, VariantType>
Generic(T&& _value) noexcept : value_(std::forward<T>(_value)) {}

~Generic();
Expand All @@ -65,9 +63,8 @@ class RFL_API Generic {
Generic& operator=(VariantType&& _value) noexcept;

/// Assigns the underlying object.
template <class T,
typename std::enable_if<std::is_convertible_v<T, VariantType>,
bool>::type = true>
template <class T>
requires std::is_convertible_v<T, VariantType>
auto& operator=(const T& _value) {
using Type = std::remove_cvref_t<T>;
if constexpr (std::is_same_v<Type, bool>) {
Expand Down
18 changes: 9 additions & 9 deletions include/rfl/Hex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace rfl {

/// Used to define a field in the NamedTuple.
template <class T>
requires std::is_integral_v<T>
requires std::is_integral_v<T>
struct Hex {
/// The underlying type.
using Type = T;
Expand All @@ -33,16 +33,16 @@ struct Hex {
template <class U>
Hex(Hex<U>&& _other) : value_(_other.get()) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Hex(const U& _value) : value_(_value) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Hex(U&& _value) noexcept : value_(std::forward<U>(_value)) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Hex(const Hex<U>& _other) : value_(_other.value()) {}

Hex(const std::string& _str) {
Expand All @@ -67,8 +67,8 @@ struct Hex {
}

/// Assigns the underlying object.
template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
auto& operator=(const U& _value) {
value_ = _value;
return *this;
Expand Down
18 changes: 9 additions & 9 deletions include/rfl/Oct.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace rfl {

/// Used to define a field in the NamedTuple.
template <class T>
requires std::is_integral_v<T>
requires std::is_integral_v<T>
struct Oct {
/// The underlying type.
using Type = T;
Expand All @@ -34,16 +34,16 @@ struct Oct {
template <class U>
Oct(Oct<U>&& _other) : value_(_other.get()) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Oct(const U& _value) : value_(_value) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Oct(U&& _value) noexcept : value_(std::forward<U>(_value)) {}

template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
Oct(const Oct<U>& _other) : value_(_other.value()) {}

Oct(const std::string& _str) {
Expand All @@ -68,8 +68,8 @@ struct Oct {
}

/// Assigns the underlying object.
template <class U, typename std::enable_if<std::is_convertible_v<U, Type>,
bool>::type = true>
template <class U>
requires std::is_convertible_v<U, Type>
auto& operator=(const U& _value) {
value_ = _value;
return *this;
Expand Down
Loading
Loading