mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Fix involuntary conversions of ExtMove to Move
The trick is to create an ambiguity for the compiler in case an unwanted conversion to Move is attempted like in: ExtMove m1{Move(17),4}, m2{Move(4),17}; std::cout << (m1 < m2) << std::endl; // 1 std::cout << (m1 > m2) << std::endl; // 1(!) This fixes issue #1204 No functional change.
This commit is contained in:
parent
9001f55147
commit
d482e3a890
1 changed files with 4 additions and 0 deletions
|
@ -42,6 +42,10 @@ struct ExtMove {
|
|||
|
||||
operator Move() const { return move; }
|
||||
void operator=(Move m) { move = m; }
|
||||
|
||||
// Inhibit unwanted implicit conversions to Move
|
||||
// with an ambiguity that yields to a compile error.
|
||||
operator float() const;
|
||||
};
|
||||
|
||||
inline bool operator<(const ExtMove& f, const ExtMove& s) {
|
||||
|
|
Loading…
Add table
Reference in a new issue