Core/Misc: Migrate our c++20 advstd to standard features

This commit is contained in:
Shauren
2023-01-07 22:38:21 +01:00
parent ec424dff3b
commit 7830e5a7a1
5 changed files with 5 additions and 25 deletions
+1 -2
View File
@@ -18,7 +18,6 @@
#ifndef __EVENTPROCESSOR_H
#define __EVENTPROCESSOR_H
#include "advstd.h"
#include "Define.h"
#include "Duration.h"
#include "Random.h"
@@ -89,7 +88,7 @@ private:
};
template<typename T>
using is_lambda_event = std::enable_if_t<!std::is_base_of_v<BasicEvent, std::remove_pointer_t<advstd::remove_cvref_t<T>>>>;
using is_lambda_event = std::enable_if_t<!std::is_base_of_v<BasicEvent, std::remove_pointer_t<std::remove_cvref_t<T>>>>;
class TC_COMMON_API EventProcessor
{
+2 -2
View File
@@ -18,7 +18,7 @@
#ifndef Types_h__
#define Types_h__
#include "advstd.h"
#include <type_traits>
namespace Trinity
{
@@ -35,7 +35,7 @@ namespace Trinity
};
template<template<typename...> typename Check, typename T1, typename... Ts>
struct find_type_if<Check, T1, Ts...> : std::conditional_t<Check<T1>::value, advstd::type_identity<T1>, find_type_if<Check, Ts...>>
struct find_type_if<Check, T1, Ts...> : std::conditional_t<Check<T1>::value, std::type_identity<T1>, find_type_if<Check, Ts...>>
{
};
-17
View File
@@ -18,26 +18,9 @@
#ifndef TRINITY_ADVSTD_H
#define TRINITY_ADVSTD_H
#include <cstddef>
#include <type_traits>
// this namespace holds implementations of upcoming stdlib features that our c++ version doesn't have yet
namespace advstd
{
// C++20 std::remove_cvref_t
template <class T>
using remove_cvref_t = std::remove_cv_t<std::remove_reference_t<T>>;
// C++20 std::type_identity
template <typename T>
struct type_identity
{
using type = T;
};
// C++20 std::type_identity_t
template <typename T>
using type_identity_t = typename type_identity<T>::type;
}
#endif
@@ -18,7 +18,6 @@
#ifndef TRINITY_CHATCOMMAND_H
#define TRINITY_CHATCOMMAND_H
#include "advstd.h"
#include "ChatCommandArgs.h"
#include "ChatCommandTags.h"
#include "Define.h"
@@ -115,7 +114,7 @@ namespace Trinity::Impl::ChatCommands
}
template <typename T> struct HandlerToTuple { static_assert(Trinity::dependant_false_v<T>, "Invalid command handler signature"); };
template <typename... Ts> struct HandlerToTuple<bool(ChatHandler*, Ts...)> { using type = std::tuple<ChatHandler*, advstd::remove_cvref_t<Ts>...>; };
template <typename... Ts> struct HandlerToTuple<bool(ChatHandler*, Ts...)> { using type = std::tuple<ChatHandler*, std::remove_cvref_t<Ts>...>; };
template <typename T> using TupleType = typename HandlerToTuple<T>::type;
struct CommandInvoker
@@ -18,7 +18,6 @@
#ifndef TRINITY_CHATCOMMANDTAGS_H
#define TRINITY_CHATCOMMANDTAGS_H
#include "advstd.h"
#include "ChatCommandHelpers.h"
#include "Hyperlinks.h"
#include "ObjectGuid.h"
@@ -211,7 +210,7 @@ namespace Trinity::ChatCommands
struct Hyperlink : Trinity::Impl::ChatCommands::ContainerTag
{
using value_type = typename linktag::value_type;
using storage_type = advstd::remove_cvref_t<value_type>;
using storage_type = std::remove_cvref_t<value_type>;
operator value_type() const { return val; }
value_type operator*() const { return val; }