1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-01 22:36:39 +00:00

Do not allow to construct NormalizedView from std::string

To avoid implicit conversion via Normalized which creates NormalizedView from a
temporary Normalized. Mark constructors explicit on purpose so there is no
ambiguity on implicit conversion when there is an overloaded function like:

void f(const Normalized&);
void f(NormalizedView);
This commit is contained in:
elsid 2024-07-20 18:46:23 +02:00
parent a9281b5246
commit a49de4b9f1
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625

View file

@ -88,6 +88,10 @@ namespace VFS::Path
NormalizedView(const Normalized& value) noexcept;
explicit NormalizedView(const std::string&) = delete;
explicit NormalizedView(std::string&&) = delete;
constexpr std::string_view value() const noexcept { return mValue; }
friend constexpr bool operator==(const NormalizedView& lhs, const NormalizedView& rhs) = default;