From 442ea8a6923595d5097e5586fafdfaab870db370 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sat, 13 Jul 2024 16:51:53 +0300 Subject: [PATCH] BAN: Remove Optional emplace constructor This was kind breaking some initializations. Emplacing is still possible through Optional::emplace --- BAN/include/BAN/Optional.h | 10 ---------- userspace/programs/Shell/main.cpp | 10 +++++----- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/BAN/include/BAN/Optional.h b/BAN/include/BAN/Optional.h index 611dff9d00..8f4987dfd8 100644 --- a/BAN/include/BAN/Optional.h +++ b/BAN/include/BAN/Optional.h @@ -18,8 +18,6 @@ namespace BAN constexpr Optional(const Optional&); constexpr Optional(const T&); constexpr Optional(T&&); - template - constexpr Optional(Args&&...); ~Optional(); @@ -85,14 +83,6 @@ namespace BAN new (m_storage) T(move(value)); } - template - template - constexpr Optional::Optional(Args&&... args) - : m_has_value(true) - { - new (m_storage) T(forward(args)...); - } - template Optional::~Optional() { diff --git a/userspace/programs/Shell/main.cpp b/userspace/programs/Shell/main.cpp index b36c30651c..645f26f23b 100644 --- a/userspace/programs/Shell/main.cpp +++ b/userspace/programs/Shell/main.cpp @@ -36,7 +36,7 @@ BAN::Optional parse_dollar(BAN::StringView command, size_t& i) ASSERT(command[i] == '$'); if (++i >= command.size()) - return "$"_sv; + return BAN::String("$"_sv); if (command[i] == '?') { @@ -53,8 +53,8 @@ BAN::Optional parse_dollar(BAN::StringView command, size_t& i) i += len - 1; if (const char* value = getenv(name.data())) - return BAN::StringView(value); - return ""_sv; + return BAN::String(value); + return BAN::String(); } else if (command[i] == '{') { @@ -74,8 +74,8 @@ BAN::Optional parse_dollar(BAN::StringView command, size_t& i) i += len; if (const char* value = getenv(name.data())) - return BAN::StringView(value); - return ""_sv; + return BAN::String(value); + return BAN::String(); } else if (command[i] == '[') {