Use nullopt instead of the no-argument constructor (#1344)

This commit is contained in:
Ken Matsui 2022-08-19 14:48:48 +09:00 committed by GitHub
parent 2465753ee9
commit 64b9484657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -79,7 +79,7 @@ class Session
{
if (typeid(T) == it->second.type())
{
return optional<T>{*(any_cast<T>(&(it->second)))};
return *(any_cast<T>(&(it->second)));
}
else
{
@ -87,7 +87,7 @@ class Session
}
}
}
return optional<T>{};
return nullopt;
}
/**
* @brief Modify or visit the data identified by the key parameter.

View File

@ -22,8 +22,10 @@
namespace drogon
{
#if __cplusplus >= 201703L || (defined _MSC_VER && _MSC_VER > 1900)
using std::nullopt;
using std::optional;
#else
const boost::none_t nullopt = boost::none;
using boost::optional;
#endif
} // namespace drogon
} // namespace drogon