Skip to content

Commit 948e4e4

Browse files
committed
Add is_variant<T>
Attempt to fix Linux compilation
1 parent 6a56038 commit 948e4e4

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

Server/mods/deathmatch/logic/luadefs/CLuaDefs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "../CVehicleManager.h"
3232
#include "../CRegistry.h"
3333
#include "../CDatabaseManager.h"
34+
#include <lua/CLuaFunctionParser.h>
3435

3536
// Used by script handlers to verify elements
3637
#define SCRIPT_VERIFY_BLIP(blip) (m_pBlipManager->Exists(blip)&&!blip->IsBeingDeleted())

Shared/mods/deathmatch/logic/lua/CLuaFunctionParser.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Multi Theft Auto is available from http://www.multitheftauto.com/
77
*
88
*****************************************************************************/
9+
#pragma once
910

1011
#include <optional>
1112
#include <variant>

Shared/sdk/SharedUtil.Template.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
/**
44
is_Nspecialization
55
6-
These structs allow testing whether a type is a specialization of a
6+
These structs allow testing whether a type is a specialization of a
77
class template
88
9-
Note: Take care of optional parameters. For example std::unordered_map
9+
Note: Take care of optional parameters. For example std::unordered_map
1010
has 5 template arguments, thus is_5specialization needs to be used, rather
11-
than is_2specialization (Key, Value).
11+
than is_2specialization (Key, Value).
1212
**/
1313

1414
template <typename Test, template <typename> class Ref>
@@ -46,6 +46,19 @@ struct is_5specialization<Ref<Arg1, Arg2, Arg3, Arg4, Arg5>, Ref> : std::true_ty
4646
using param2_t = Arg2;
4747
};
4848

49+
template <typename Test>
50+
struct is_variant : std::false_type
51+
{
52+
};
53+
54+
template <typename Arg1, typename... Args>
55+
struct is_variant<std::variant<Arg1, Args...>> : std::true_type
56+
{
57+
using param1_t = Arg1;
58+
using rest_t = std::variant<Args...>;
59+
static constexpr auto count = sizeof...(Args) + 1;
60+
};
61+
4962
/**
5063
nth_element
5164

0 commit comments

Comments
 (0)