Changeset - r27427:d874eb1efeac
[Not reviewed]
master
0 1 0
Rubidium - 13 months ago 2023-05-23 17:43:00
rubidium@openttd.org
Codechange: use Tthis instead of StrongTypedef, so ==/= does not compare/assign different strong typedefs
1 file changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/core/strong_typedef_type.hpp
Show inline comments
 
@@ -35,14 +35,14 @@ struct StrongTypedef : StrongTypedefBase
 

	
 
	debug_inline constexpr StrongTypedef(const T &value) : value(value) {}
 

	
 
	debug_inline constexpr Tthis &operator =(const StrongTypedef &rhs) { this->value = rhs.value; return static_cast<Tthis &>(*this); }
 
	debug_inline constexpr Tthis &operator =(StrongTypedef &&rhs) { this->value = std::move(rhs.value); return static_cast<Tthis &>(*this); }
 
	debug_inline constexpr Tthis &operator =(const Tthis &rhs) { this->value = rhs.value; return static_cast<Tthis &>(*this); }
 
	debug_inline constexpr Tthis &operator =(Tthis &&rhs) { this->value = std::move(rhs.value); return static_cast<Tthis &>(*this); }
 
	debug_inline constexpr Tthis &operator =(const T &rhs) { this->value = rhs; return static_cast<Tthis &>(*this); }
 

	
 
	explicit constexpr operator T() const { return this->value; }
 

	
 
	constexpr bool operator ==(const StrongTypedef &rhs) const { return this->value == rhs.value; }
 
	constexpr bool operator !=(const StrongTypedef &rhs) const { return this->value != rhs.value; }
 
	constexpr bool operator ==(const Tthis &rhs) const { return this->value == rhs.value; }
 
	constexpr bool operator !=(const Tthis &rhs) const { return this->value != rhs.value; }
 
	constexpr bool operator ==(const T &rhs) const { return this->value == rhs; }
 
	constexpr bool operator !=(const T &rhs) const { return this->value != rhs; }
 
};
 
@@ -62,8 +62,8 @@ struct StrongIntegralTypedef : StrongTyp
 

	
 
	debug_inline constexpr StrongIntegralTypedef(const T &value) : StrongTypedef<T, Tthis>(value) {}
 

	
 
	debug_inline constexpr Tthis &operator =(const StrongIntegralTypedef &rhs) { this->value = rhs.value; return static_cast<Tthis &>(*this); }
 
	debug_inline constexpr Tthis &operator =(StrongIntegralTypedef &&rhs) { this->value = std::move(rhs.value); return static_cast<Tthis &>(*this); }
 
	debug_inline constexpr Tthis &operator =(const Tthis &rhs) { this->value = rhs.value; return static_cast<Tthis &>(*this); }
 
	debug_inline constexpr Tthis &operator =(Tthis &&rhs) { this->value = std::move(rhs.value); return static_cast<Tthis &>(*this); }
 
	debug_inline constexpr Tthis &operator =(const T &rhs) { this->value = rhs; return static_cast<Tthis &>(*this); }
 

	
 
	constexpr Tthis &operator ++() { this->value++; return static_cast<Tthis &>(*this); }
0 comments (0 inline, 0 general)