diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/aloptional.h | 17 | ||||
-rw-r--r-- | common/strutils.cpp | 8 | ||||
-rw-r--r-- | common/strutils.h | 7 |
3 files changed, 7 insertions, 25 deletions
diff --git a/common/aloptional.h b/common/aloptional.h deleted file mode 100644 index 45b0cf8a..00000000 --- a/common/aloptional.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef AL_OPTIONAL_H -#define AL_OPTIONAL_H - -#include <optional> - -namespace al { - -constexpr auto nullopt = std::nullopt; - -template<typename T> -using optional = std::optional<T>; - -using std::make_optional; - -} // namespace al - -#endif /* AL_OPTIONAL_H */ diff --git a/common/strutils.cpp b/common/strutils.cpp index d0418eff..b221b6ec 100644 --- a/common/strutils.cpp +++ b/common/strutils.cpp @@ -43,21 +43,21 @@ std::wstring utf8_to_wstr(const char *str) namespace al { -al::optional<std::string> getenv(const char *envname) +std::optional<std::string> getenv(const char *envname) { const char *str{std::getenv(envname)}; if(str && str[0] != '\0') return str; - return al::nullopt; + return std::nullopt; } #ifdef _WIN32 -al::optional<std::wstring> getenv(const WCHAR *envname) +std::optional<std::wstring> getenv(const WCHAR *envname) { const WCHAR *str{_wgetenv(envname)}; if(str && str[0] != L'\0') return str; - return al::nullopt; + return std::nullopt; } #endif diff --git a/common/strutils.h b/common/strutils.h index 0c7a0e22..67f057a7 100644 --- a/common/strutils.h +++ b/common/strutils.h @@ -1,10 +1,9 @@ #ifndef AL_STRUTILS_H #define AL_STRUTILS_H +#include <optional> #include <string> -#include "aloptional.h" - #ifdef _WIN32 #include <wchar.h> @@ -14,9 +13,9 @@ std::wstring utf8_to_wstr(const char *str); namespace al { -al::optional<std::string> getenv(const char *envname); +std::optional<std::string> getenv(const char *envname); #ifdef _WIN32 -al::optional<std::wstring> getenv(const wchar_t *envname); +std::optional<std::wstring> getenv(const wchar_t *envname); #endif } // namespace al |