diff options
author | Chris Robinson <[email protected]> | 2019-07-01 17:25:58 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-07-01 17:25:58 -0700 |
commit | 6bb0edf0a57bdb95c017db986f76eddbc80857e1 (patch) | |
tree | dc2b0677dc338843c585b2499136d16b56e9d1f0 /Alc | |
parent | 53c13de5ce6467f15cc12c855418ed2589a8508a (diff) |
Create and use a make_optional method
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/alc.cpp | 2 | ||||
-rw-r--r-- | Alc/alconfig.cpp | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index 521da6bc..df272c2a 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -1373,7 +1373,7 @@ static al::optional<DevFmtPair> DecomposeDevFormat(ALenum format) for(const auto &item : list) { if(item.format == format) - return al::optional<DevFmtPair>{{item.channels, item.type}}; + return al::make_optional(DevFmtPair{item.channels, item.type}); } return al::nullopt; diff --git a/Alc/alconfig.cpp b/Alc/alconfig.cpp index b6e406fd..5f5f9149 100644 --- a/Alc/alconfig.cpp +++ b/Alc/alconfig.cpp @@ -497,7 +497,7 @@ al::optional<std::string> ConfigValueStr(const char *devName, const char *blockN const char *val = GetConfigValue(devName, blockName, keyName, ""); if(!val[0]) return al::nullopt; - return al::optional<std::string>{val}; + return al::make_optional<std::string>(val); } al::optional<int> ConfigValueInt(const char *devName, const char *blockName, const char *keyName) @@ -505,7 +505,7 @@ al::optional<int> ConfigValueInt(const char *devName, const char *blockName, con const char *val = GetConfigValue(devName, blockName, keyName, ""); if(!val[0]) return al::nullopt; - return al::optional<int>{static_cast<int>(std::strtol(val, nullptr, 0))}; + return al::make_optional(static_cast<int>(std::strtol(val, nullptr, 0))); } al::optional<unsigned int> ConfigValueUInt(const char *devName, const char *blockName, const char *keyName) @@ -513,7 +513,7 @@ al::optional<unsigned int> ConfigValueUInt(const char *devName, const char *bloc const char *val = GetConfigValue(devName, blockName, keyName, ""); if(!val[0]) return al::nullopt; - return al::optional<unsigned int>{static_cast<unsigned int>(std::strtoul(val, nullptr, 0))}; + return al::make_optional(static_cast<unsigned int>(std::strtoul(val, nullptr, 0))); } al::optional<float> ConfigValueFloat(const char *devName, const char *blockName, const char *keyName) @@ -521,7 +521,7 @@ al::optional<float> ConfigValueFloat(const char *devName, const char *blockName, const char *val = GetConfigValue(devName, blockName, keyName, ""); if(!val[0]) return al::nullopt; - return al::optional<float>{std::strtof(val, nullptr)}; + return al::make_optional(std::strtof(val, nullptr)); } al::optional<bool> ConfigValueBool(const char *devName, const char *blockName, const char *keyName) @@ -529,9 +529,9 @@ al::optional<bool> ConfigValueBool(const char *devName, const char *blockName, c const char *val = GetConfigValue(devName, blockName, keyName, ""); if(!val[0]) return al::nullopt; - return al::optional<bool>{ + return al::make_optional( strcasecmp(val, "true") == 0 || strcasecmp(val, "yes") == 0 || - strcasecmp(val, "on") == 0 || atoi(val) != 0}; + strcasecmp(val, "on") == 0 || atoi(val) != 0); } int GetConfigValueBool(const char *devName, const char *blockName, const char *keyName, int def) |