Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Default comparisons for type derived from Moveable
Default comparisons for type derived from Moveable [message #60322] Tue, 21 November 2023 13:39
busiek is currently offline  busiek
Messages: 66
Registered: February 2011
Location: Poland
Member
With c++20 with have a feature to generate comparisons operator: Default comparisons. However, when class is derived from Upp::Moveable (which is common case) we face a problem that there is no default generated comparison operator for EmptyClass. The definition of this class could be changed to:
struct EmptyClass
{
#if __cplusplus >= 202002L
	auto operator<=>(const EmptyClass&) const = default;
#endif
};

But then it leads to some conflicts for classes derived from Moveable which have some comparison operator defined by themselves. This means I have to use NTL_MOVEABLE() which is not as convenient as inheriting from Moveable. Is there any simple way in Upp to fix that?

[Updated on: Tue, 21 November 2023 14:48]

Report message to a moderator

Previous Topic: Weird result with Format();
Next Topic: How to create a hidden folder?
Goto Forum:
  


Current Time: Sat Jul 20 17:39:12 CEST 2024

Total time taken to generate the page: 0.01749 seconds