-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for default implementation of static virtuals with method…
… constraints (#89061) - The major problem was the logic which incorrectly would instantiate the methods when it wasn't necessary - As the number of flags to the implementation functions has grown very large, this change also includes logic converting them all to a single flags variable when passing them around Fixes #73658 Fixes #78865
- Loading branch information
1 parent
ef4860a
commit d1adf81
Showing
13 changed files
with
488 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
#ifndef ENUM_CLASS_FLAGS_OPERATORS | ||
#define ENUM_CLASS_FLAGS_OPERATORS | ||
|
||
template <typename T> | ||
inline auto operator& (T left, T right) -> decltype(T::support_use_as_flags) | ||
{ | ||
return static_cast<T>(static_cast<int>(left) & static_cast<int>(right)); | ||
} | ||
|
||
template <typename T> | ||
inline auto operator| (T left, T right) -> decltype(T::support_use_as_flags) | ||
{ | ||
return static_cast<T>(static_cast<int>(left) | static_cast<int>(right)); | ||
} | ||
|
||
template <typename T> | ||
inline auto operator^ (T left, T right) -> decltype(T::support_use_as_flags) | ||
{ | ||
return static_cast<T>(static_cast<int>(left) ^ static_cast<int>(right)); | ||
} | ||
|
||
template <typename T> | ||
inline auto operator~ (T value) -> decltype(T::support_use_as_flags) | ||
{ | ||
return static_cast<T>(~static_cast<int>(value)); | ||
} | ||
|
||
template <typename T> | ||
inline auto operator |= (T& left, T right) -> const decltype(T::support_use_as_flags)& | ||
{ | ||
left = left | right; | ||
return left; | ||
} | ||
|
||
template <typename T> | ||
inline auto operator &= (T& left, T right) -> const decltype(T::support_use_as_flags)& | ||
{ | ||
left = left & right; | ||
return left; | ||
} | ||
|
||
template <typename T> | ||
inline auto operator ^= (T& left, T right) -> const decltype(T::support_use_as_flags)& | ||
{ | ||
left = left ^ right; | ||
return left; | ||
} | ||
|
||
#endif /* ENUM_CLASS_FLAGS_OPERATORS */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.