Skip to content

Commit

Permalink
lsp: Separate includes and use enable_if_t
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanjameswatson committed Oct 7, 2023
1 parent 80a8716 commit ed79ff5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lspserver/include/lspserver/LSPBinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
#include <llvm/ADT/FunctionExtras.h>
#include <llvm/ADT/StringMap.h>
#include <llvm/Support/JSON.h>

#include <type_traits>

namespace lspserver {

namespace detail {

template <typename T>
typename std::enable_if<std::is_default_constructible_v<T>, T>::type
typename std::enable_if_t<std::is_default_constructible_v<T>, T>
valueOrUninitialized(const std::optional<T> &OptionalDefault) {
T Result;
if (OptionalDefault) {
Expand All @@ -23,7 +24,7 @@ valueOrUninitialized(const std::optional<T> &OptionalDefault) {
}

template <typename T>
typename std::enable_if<!std::is_default_constructible_v<T>, T>::type
typename std::enable_if_t<!std::is_default_constructible_v<T>, T>
valueOrUninitialized(const std::optional<T> &OptionalDefault) {
return OptionalDefault.value();
}
Expand Down Expand Up @@ -54,8 +55,7 @@ llvm::Expected<T> parseParamWithOptionalDefault(
} // namespace detail

template <typename T>
typename std::enable_if<std::is_default_constructible_v<T>,
llvm::Expected<T>>::type
typename std::enable_if_t<std::is_default_constructible_v<T>, llvm::Expected<T>>
parseParam(const llvm::json::Value &Raw, llvm::StringRef PayloadName,
llvm::StringRef PayloadKind) {
return detail::parseParamWithOptionalDefault<T>(Raw, PayloadName,
Expand Down

0 comments on commit ed79ff5

Please sign in to comment.