mirror of
https://github.com/github/codeql.git
synced 2026-05-03 04:39:29 +02:00
Revert "Swift: use C++20 constraints and concepts to simplify code"
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
#include <binlog/binlog.hpp>
|
||||
#include <cmath>
|
||||
#include <charconv>
|
||||
#include <concepts>
|
||||
|
||||
namespace codeql {
|
||||
|
||||
@@ -83,8 +82,9 @@ class TrapLabel : public UntypedTrapLabel {
|
||||
static TrapLabel unsafeCreateFromUntyped(UntypedTrapLabel label) { return TrapLabel{label.id_}; }
|
||||
|
||||
template <typename SourceTag>
|
||||
requires std::derived_from<SourceTag, Tag> TrapLabel(const TrapLabel<SourceTag>& other)
|
||||
: UntypedTrapLabel(other) {}
|
||||
TrapLabel(const TrapLabel<SourceTag>& other) : UntypedTrapLabel(other) {
|
||||
static_assert(std::is_base_of_v<Tag, SourceTag>, "wrong label assignment!");
|
||||
}
|
||||
};
|
||||
|
||||
// wrapper class to allow directly assigning a vector of TrapLabel<A> to a vector of
|
||||
@@ -96,8 +96,8 @@ struct TrapLabelVectorWrapper {
|
||||
std::vector<TrapLabel<TagParam>> data;
|
||||
|
||||
template <typename DestinationTag>
|
||||
requires std::derived_from<Tag, DestinationTag>
|
||||
operator std::vector<TrapLabel<DestinationTag>>() && {
|
||||
static_assert(std::is_base_of_v<DestinationTag, Tag>, "wrong label assignment!");
|
||||
// reinterpret_cast is safe because TrapLabel instances differ only on the type, not the
|
||||
// underlying data
|
||||
return std::move(reinterpret_cast<std::vector<TrapLabel<DestinationTag>>&>(data));
|
||||
|
||||
Reference in New Issue
Block a user