Skip to content

Commit

Permalink
Replace deduction guides with an additional template parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkrupinski committed Nov 29, 2024
1 parent 185c576 commit 740c16f
Show file tree
Hide file tree
Showing 39 changed files with 76 additions and 161 deletions.
4 changes: 2 additions & 2 deletions Source/FeatureHelpers/HudInWorldPanels.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ struct HudInWorldPanels {
[[nodiscard]] auto getPanel(HudInWorldPanelIndex index, auto& hookContext) const noexcept
{
if (std::cmp_less(index, containerPanelChildren.size))
return PanoramaUiPanel{PanoramaUiPanelContext{hookContext, containerPanelChildren.memory[index]}};
return PanoramaUiPanel{PanoramaUiPanelContext{hookContext, nullptr}};
return hookContext.template make<PanoramaUiPanel>(containerPanelChildren.memory[index]);
return hookContext.template make<PanoramaUiPanel>(nullptr);
}

[[nodiscard]] HudInWorldPanelIndex getIndexOfLastPanel() const noexcept
Expand Down
5 changes: 1 addition & 4 deletions Source/Features/Hud/BombTimer/BombTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <Common/Visibility.h>
#include "BombTimerContext.h"

template <typename Context>
template <typename HookContext, typename Context = BombTimerContext<HookContext>>
class BombTimer {
public:
template <typename... Args>
Expand Down Expand Up @@ -38,6 +38,3 @@ class BombTimer {
private:
Context context;
};

template <typename HookContext>
BombTimer(HookContext&) -> BombTimer<BombTimerContext<HookContext>>;
5 changes: 1 addition & 4 deletions Source/Features/Hud/PostRoundTimer/PostRoundTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <Common/Visibility.h>
#include "PostRoundTimerContext.h"

template <typename Context>
template <typename HookContext, typename Context = PostRoundTimerContext<HookContext>>
class PostRoundTimer {
public:
template <typename... Args>
Expand Down Expand Up @@ -32,6 +32,3 @@ class PostRoundTimer {
private:
Context context;
};

template <typename HookContext>
PostRoundTimer(HookContext&) -> PostRoundTimer<PostRoundTimerContext<HookContext>>;
7 changes: 2 additions & 5 deletions Source/Features/Hud/PostRoundTimer/PostRoundTimerToggle.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <FeatureHelpers/FeatureToggle.h>
#include "PostRoundTimerContext.h"

template <typename Context>
struct PostRoundTimerToggle : FeatureToggleOff<PostRoundTimerToggle<Context>> {
template <typename HookContext, typename Context = PostRoundTimerContext<HookContext>>
struct PostRoundTimerToggle : FeatureToggleOff<PostRoundTimerToggle<HookContext, Context>> {
template <typename... Args>
PostRoundTimerToggle(Args&&... args) noexcept
: context{std::forward<Args>(args)...}
Expand All @@ -26,6 +26,3 @@ struct PostRoundTimerToggle : FeatureToggleOff<PostRoundTimerToggle<Context>> {
private:
Context context;
};

template <typename HookContext>
PostRoundTimerToggle(HookContext&) -> PostRoundTimerToggle<PostRoundTimerContext<HookContext>>;
2 changes: 1 addition & 1 deletion Source/Features/Sound/Details/SoundVisualizationFeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class SoundVisualizationFeature {
state.panelIndices.pushBack(inWorldPanels.getIndexOfLastPanel());
return panel;
}
return PanoramaUiPanel{PanoramaUiPanelContext{hookContext, nullptr}};
return hookContext.template make<PanoramaUiPanel>(nullptr);
}

SoundVisualizationFeatureState& state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "DefuseKitOutlineGlowContext.h"
#include "DefuseKitOutlineGlowParams.h"

template <typename Context>
template <typename HookContext, typename Context = DefuseKitOutlineGlowContext<HookContext>>
class DefuseKitOutlineGlow {
public:
template <typename... Args>
Expand All @@ -25,6 +25,3 @@ class DefuseKitOutlineGlow {
private:
Context context;
};

template <typename HookContext>
DefuseKitOutlineGlow(HookContext&) -> DefuseKitOutlineGlow<DefuseKitOutlineGlowContext<HookContext>>;
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <FeatureHelpers/FeatureToggle.h>
#include "DefuseKitOutlineGlowContext.h"

template <typename Context>
class DefuseKitOutlineGlowToggle : public FeatureToggle<DefuseKitOutlineGlowToggle<Context>> {
template <typename HookContext, typename Context = DefuseKitOutlineGlowContext<HookContext>>
class DefuseKitOutlineGlowToggle : public FeatureToggle<DefuseKitOutlineGlowToggle<HookContext, Context>> {
public:
template <typename... Args>
DefuseKitOutlineGlowToggle(Args&&... args) noexcept
Expand All @@ -20,6 +20,3 @@ class DefuseKitOutlineGlowToggle : public FeatureToggle<DefuseKitOutlineGlowTogg
private:
Context context;
};

template <typename HookContext>
DefuseKitOutlineGlowToggle(HookContext&) -> DefuseKitOutlineGlowToggle<DefuseKitOutlineGlowContext<HookContext>>;
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "DroppedBombOutlineGlowContext.h"
#include "DroppedBombOutlineGlowParams.h"

template <typename Context>
template <typename HookContext, typename Context = DroppedBombOutlineGlowContext<HookContext>>
class DroppedBombOutlineGlow {
public:
template <typename... Args>
Expand All @@ -27,6 +27,3 @@ class DroppedBombOutlineGlow {
private:
Context context;
};

template <typename HookContext>
DroppedBombOutlineGlow(HookContext&) -> DroppedBombOutlineGlow<DroppedBombOutlineGlowContext<HookContext>>;
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <FeatureHelpers/FeatureToggle.h>
#include "DroppedBombOutlineGlowContext.h"

template <typename Context>
class DroppedBombOutlineGlowToggle : public FeatureToggle<DroppedBombOutlineGlowToggle<Context>> {
template <typename HookContext, typename Context = DroppedBombOutlineGlowContext<HookContext>>
class DroppedBombOutlineGlowToggle : public FeatureToggle<DroppedBombOutlineGlowToggle<HookContext, Context>> {
public:
template <typename... Args>
DroppedBombOutlineGlowToggle(Args&&... args) noexcept
Expand All @@ -22,6 +22,3 @@ class DroppedBombOutlineGlowToggle : public FeatureToggle<DroppedBombOutlineGlow
private:
Context context;
};

template <typename HookContext>
DroppedBombOutlineGlowToggle(HookContext&) -> DroppedBombOutlineGlowToggle<DroppedBombOutlineGlowContext<HookContext>>;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "GrenadeProjectileOutlineGlowContext.h"
#include "GrenadeProjectileOutlineGlowParams.h"

template <typename Context>
template <typename HookContext, typename Context = GrenadeProjectileOutlineGlowContext<HookContext>>
class GrenadeProjectileOutlineGlow {
public:
template <typename... Args>
Expand Down Expand Up @@ -42,6 +42,3 @@ class GrenadeProjectileOutlineGlow {

Context context;
};

template <typename HookContext>
GrenadeProjectileOutlineGlow(HookContext&) -> GrenadeProjectileOutlineGlow<GrenadeProjectileOutlineGlowContext<HookContext>>;
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <FeatureHelpers/FeatureToggle.h>
#include "GrenadeProjectileOutlineGlowContext.h"

template <typename Context>
class GrenadeProjectileOutlineGlowToggle : public FeatureToggle<GrenadeProjectileOutlineGlowToggle<Context>> {
template <typename HookContext, typename Context = GrenadeProjectileOutlineGlowContext<HookContext>>
class GrenadeProjectileOutlineGlowToggle : public FeatureToggle<GrenadeProjectileOutlineGlowToggle<HookContext, Context>> {
public:
template <typename... Args>
GrenadeProjectileOutlineGlowToggle(Args&&... args) noexcept
Expand All @@ -20,6 +20,3 @@ class GrenadeProjectileOutlineGlowToggle : public FeatureToggle<GrenadeProjectil
private:
Context context;
};

template <typename HookContext>
GrenadeProjectileOutlineGlowToggle(HookContext&) -> GrenadeProjectileOutlineGlowToggle<GrenadeProjectileOutlineGlowContext<HookContext>>;
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#include "HostageOutlineGlowContext.h"
#include "HostageOutlineGlowParams.h"


template <typename Context>
template <typename HookContext, typename Context = HostageOutlineGlowContext<HookContext>>
class HostageOutlineGlow {
public:
template <typename... Args>
Expand All @@ -26,6 +25,3 @@ class HostageOutlineGlow {
private:
Context context;
};

template <typename HookContext>
HostageOutlineGlow(HookContext&) -> HostageOutlineGlow<HostageOutlineGlowContext<HookContext>>;
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <FeatureHelpers/FeatureToggle.h>
#include "HostageOutlineGlowContext.h"

template <typename Context>
class HostageOutlineGlowToggle : public FeatureToggle<HostageOutlineGlowToggle<Context>> {
template <typename HookContext, typename Context = GrenadeProjectileOutlineGlowContext<HookContext>>
class HostageOutlineGlowToggle : public FeatureToggle<HostageOutlineGlowToggle<HookContext, Context>> {
public:
template <typename... Args>
HostageOutlineGlowToggle(Args&&... args) noexcept
Expand All @@ -20,6 +20,3 @@ class HostageOutlineGlowToggle : public FeatureToggle<HostageOutlineGlowToggle<C
private:
Context context;
};

template <typename HookContext>
HostageOutlineGlowToggle(HookContext&) -> HostageOutlineGlowToggle<GrenadeProjectileOutlineGlowContext<HookContext>>;
5 changes: 1 addition & 4 deletions Source/Features/Visuals/OutlineGlow/OutlineGlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <utility>
#include "OutlineGlowContext.h"

template <typename Context>
template <typename HookContext, typename Context = OutlineGlowContext<HookContext>>
class OutlineGlow {
public:
template <typename... Args>
Expand Down Expand Up @@ -39,6 +39,3 @@ class OutlineGlow {
private:
Context context;
};

template <typename HookContext>
OutlineGlow(HookContext&) -> OutlineGlow<OutlineGlowContext<HookContext>>;
7 changes: 2 additions & 5 deletions Source/Features/Visuals/OutlineGlow/OutlineGlowToggle.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <FeatureHelpers/FeatureToggle.h>
#include "OutlineGlowContext.h"

template <typename Context>
class OutlineGlowToggle : public FeatureToggleOff<OutlineGlowToggle<Context>> {
template <typename HookContext, typename Context = OutlineGlowContext<HookContext>>
class OutlineGlowToggle : public FeatureToggleOff<OutlineGlowToggle<HookContext, Context>> {
public:
template <typename... Args>
OutlineGlowToggle(Args&&... args) noexcept
Expand All @@ -25,6 +25,3 @@ class OutlineGlowToggle : public FeatureToggleOff<OutlineGlowToggle<Context>> {
private:
Context context;
};

template <typename HookContext>
OutlineGlowToggle(HookContext&) -> OutlineGlowToggle<OutlineGlowContext<HookContext>>;
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "OutlineGlowContext.h"

template <typename Context>
template <typename HookContext, typename Context = OutlineGlowContext<HookContext>>
class OutlineGlowUnloadHandler {
public:
template <typename... Args>
Expand All @@ -21,6 +21,3 @@ class OutlineGlowUnloadHandler {
private:
Context context;
};

template <typename HookContext>
OutlineGlowUnloadHandler(HookContext&) -> OutlineGlowUnloadHandler<OutlineGlowContext<HookContext>>;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "PlayerOutlineGlowContext.h"
#include "PlayerOutlineGlowColorType.h"

template <typename Context>
template <typename HookContext, typename Context = PlayerOutlineGlowContext<HookContext>>
class PlayerOutlineGlow {
public:
template <typename... Args>
Expand Down Expand Up @@ -54,6 +54,3 @@ class PlayerOutlineGlow {

Context context;
};

template <typename HookContext>
PlayerOutlineGlow(HookContext&) -> PlayerOutlineGlow<PlayerOutlineGlowContext<HookContext>>;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

#include <utility>

template <typename Context>
template <typename HookContext>
class PlayerOutlineGlowContext;

template <typename HookContext, typename Context = PlayerOutlineGlowContext<HookContext>>
class PlayerOutlineGlowCondition {
public:
template <typename... Args>
Expand All @@ -29,9 +32,3 @@ class PlayerOutlineGlowCondition {
private:
Context context;
};

template <typename HookContext>
class PlayerOutlineGlowContext;

template <typename HookContext>
PlayerOutlineGlowCondition(HookContext&) -> PlayerOutlineGlowCondition<PlayerOutlineGlowContext<HookContext>>;
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
#include <FeatureHelpers/FeatureToggle.h>
#include "PlayerOutlineGlowColorType.h"

template <typename Context>
struct PlayerOutlineGlowToggle : FeatureToggle<PlayerOutlineGlowToggle<Context>> {
template <typename HookContext>
class PlayerOutlineGlowContext;

template <typename HookContext, typename Context = PlayerOutlineGlowContext<HookContext>>
struct PlayerOutlineGlowToggle : FeatureToggle<PlayerOutlineGlowToggle<HookContext, Context>> {
template <typename... Args>
PlayerOutlineGlowToggle(Args&&... args) noexcept
: context{std::forward<Args>(args)...}
Expand Down Expand Up @@ -37,9 +40,3 @@ struct PlayerOutlineGlowToggle : FeatureToggle<PlayerOutlineGlowToggle<Context>>
private:
Context context;
};

template <typename HookContext>
class PlayerOutlineGlowContext;

template <typename HookContext>
PlayerOutlineGlowToggle(HookContext&) -> PlayerOutlineGlowToggle<PlayerOutlineGlowContext<HookContext>>;
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "TickingBombOutlineGlowContext.h"
#include "TickingBombOutlineGlowParams.h"

template <typename Context>
template <typename HookContext, typename Context = TickingBombOutlineGlowContext<HookContext>>
class TickingBombOutlineGlow {
public:
template <typename... Args>
Expand All @@ -27,6 +27,3 @@ class TickingBombOutlineGlow {
private:
Context context;
};

template <typename HookContext>
TickingBombOutlineGlow(HookContext&) -> TickingBombOutlineGlow<TickingBombOutlineGlowContext<HookContext>>;
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <FeatureHelpers/FeatureToggle.h>
#include "TickingBombOutlineGlowContext.h"

template <typename Context>
class TickingBombOutlineGlowToggle : public FeatureToggle<TickingBombOutlineGlowToggle<Context>> {
template <typename HookContext, typename Context = TickingBombOutlineGlowContext<HookContext>>
class TickingBombOutlineGlowToggle : public FeatureToggle<TickingBombOutlineGlowToggle<HookContext, Context>> {
public:
template <typename... Args>
TickingBombOutlineGlowToggle(Args&&... args) noexcept
Expand All @@ -22,6 +22,3 @@ class TickingBombOutlineGlowToggle : public FeatureToggle<TickingBombOutlineGlow
private:
Context context;
};

template <typename HookContext>
TickingBombOutlineGlowToggle(HookContext&) -> TickingBombOutlineGlowToggle<TickingBombOutlineGlowContext<HookContext>>;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "WeaponOutlineGlowContext.h"
#include "WeaponOutlineGlowParams.h"

template <typename Context>
template <typename HookContext, typename Context = WeaponOutlineGlowContext<HookContext>>
class WeaponOutlineGlow {
public:
template <typename... Args>
Expand Down Expand Up @@ -41,6 +41,3 @@ class WeaponOutlineGlow {

Context context;
};

template <typename HookContext>
WeaponOutlineGlow(HookContext&) -> WeaponOutlineGlow<WeaponOutlineGlowContext<HookContext>>;
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <FeatureHelpers/FeatureToggle.h>
#include "WeaponOutlineGlowContext.h"

template <typename Context>
class WeaponOutlineGlowToggle : public FeatureToggle<WeaponOutlineGlowToggle<Context>> {
template <typename HookContext, typename Context = WeaponOutlineGlowContext<HookContext>>
class WeaponOutlineGlowToggle : public FeatureToggle<WeaponOutlineGlowToggle<HookContext, Context>> {
public:
template <typename... Args>
WeaponOutlineGlowToggle(Args&&... args) noexcept
Expand All @@ -20,6 +20,3 @@ class WeaponOutlineGlowToggle : public FeatureToggle<WeaponOutlineGlowToggle<Con
private:
Context context;
};

template <typename HookContext>
WeaponOutlineGlowToggle(HookContext&) -> WeaponOutlineGlowToggle<WeaponOutlineGlowContext<HookContext>>;
Loading

0 comments on commit 740c16f

Please sign in to comment.