Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 3 additions & 39 deletions sycl/include/sycl/detail/string_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,51 +68,15 @@ class string_view {

constexpr const char *data() const noexcept { return str ? str : ""; }

constexpr explicit operator std::string_view() const noexcept {
constexpr operator std::string_view() const noexcept {
if (str == nullptr)
return std::string_view{};
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
return std::string_view(str, len);
#else
return std::string_view(str);
#endif
}

#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
friend constexpr bool operator==(string_view lhs,
std::string_view rhs) noexcept {
return rhs == std::string_view(lhs);
}
friend constexpr bool operator==(std::string_view lhs,
string_view rhs) noexcept {
return lhs == std::string_view(rhs);
}

friend constexpr bool operator!=(string_view lhs,
std::string_view rhs) noexcept {
return rhs != std::string_view(lhs);
}
friend constexpr bool operator!=(std::string_view lhs,
string_view rhs) noexcept {
return lhs != std::string_view(rhs);
}
#else
friend constexpr bool operator==(string_view lhs,
std::string_view rhs) noexcept {
return rhs == lhs.data();
}
friend constexpr bool operator==(std::string_view lhs,
string_view rhs) noexcept {
return lhs == rhs.data();
}

friend constexpr bool operator!=(string_view lhs,
std::string_view rhs) noexcept {
return rhs != lhs.data();
}
friend constexpr bool operator!=(std::string_view lhs,
string_view rhs) noexcept {
return lhs != rhs.data();
}
#endif
};

} // namespace detail
Expand Down
Loading