BAN: Remove Optional emplace constructor

This was kind breaking some initializations. Emplacing is still possible
through Optional::emplace
This commit is contained in:
Bananymous 2024-07-13 16:51:53 +03:00
parent 749be67df3
commit 442ea8a692
2 changed files with 5 additions and 15 deletions

View File

@ -18,8 +18,6 @@ namespace BAN
constexpr Optional(const Optional&); constexpr Optional(const Optional&);
constexpr Optional(const T&); constexpr Optional(const T&);
constexpr Optional(T&&); constexpr Optional(T&&);
template<typename... Args>
constexpr Optional(Args&&...);
~Optional(); ~Optional();
@ -85,14 +83,6 @@ namespace BAN
new (m_storage) T(move(value)); new (m_storage) T(move(value));
} }
template<typename T>
template<typename... Args>
constexpr Optional<T>::Optional(Args&&... args)
: m_has_value(true)
{
new (m_storage) T(forward<Args>(args)...);
}
template<typename T> template<typename T>
Optional<T>::~Optional() Optional<T>::~Optional()
{ {

View File

@ -36,7 +36,7 @@ BAN::Optional<BAN::String> parse_dollar(BAN::StringView command, size_t& i)
ASSERT(command[i] == '$'); ASSERT(command[i] == '$');
if (++i >= command.size()) if (++i >= command.size())
return "$"_sv; return BAN::String("$"_sv);
if (command[i] == '?') if (command[i] == '?')
{ {
@ -53,8 +53,8 @@ BAN::Optional<BAN::String> parse_dollar(BAN::StringView command, size_t& i)
i += len - 1; i += len - 1;
if (const char* value = getenv(name.data())) if (const char* value = getenv(name.data()))
return BAN::StringView(value); return BAN::String(value);
return ""_sv; return BAN::String();
} }
else if (command[i] == '{') else if (command[i] == '{')
{ {
@ -74,8 +74,8 @@ BAN::Optional<BAN::String> parse_dollar(BAN::StringView command, size_t& i)
i += len; i += len;
if (const char* value = getenv(name.data())) if (const char* value = getenv(name.data()))
return BAN::StringView(value); return BAN::String(value);
return ""_sv; return BAN::String();
} }
else if (command[i] == '[') else if (command[i] == '[')
{ {