From 70b21e90d7be4d892b7d17440d64630e7ee1a575 Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 3 Mar 2022 19:17:48 +0100 Subject: refactor: improve factories --- src/interfaces/bounds.hpp | 4 +--- src/interfaces/matrix.hpp | 4 +--- src/interfaces/randomization.hpp | 5 ++--- src/interfaces/vector2.hpp | 4 +--- 4 files changed, 5 insertions(+), 12 deletions(-) (limited to 'src/interfaces') diff --git a/src/interfaces/bounds.hpp b/src/interfaces/bounds.hpp index 7e920cf..b431874 100644 --- a/src/interfaces/bounds.hpp +++ b/src/interfaces/bounds.hpp @@ -2,7 +2,6 @@ #include "interfaces/vector2.hpp" -#include #include enum CoordsValidation @@ -39,5 +38,4 @@ struct IBoundsOptions unsigned int height; }; -using IBoundsFactory = - std::function(const IBoundsOptions &options)>; +using IBoundsFactory = std::shared_ptr (*)(const IBoundsOptions &options); diff --git a/src/interfaces/matrix.hpp b/src/interfaces/matrix.hpp index ab5f40b..72d18d9 100644 --- a/src/interfaces/matrix.hpp +++ b/src/interfaces/matrix.hpp @@ -3,7 +3,6 @@ #include "interfaces/bounds.hpp" #include "interfaces/vector2.hpp" -#include #include template @@ -46,5 +45,4 @@ public: }; template -using IMatrixFactory = - std::function>(const IBounds &bounds)>; +using IMatrixFactory = std::shared_ptr> (*)(const IBounds &bounds); diff --git a/src/interfaces/randomization.hpp b/src/interfaces/randomization.hpp index 9eeec0a..12f6486 100644 --- a/src/interfaces/randomization.hpp +++ b/src/interfaces/randomization.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include class ISeedGenerator @@ -11,7 +10,7 @@ public: [[nodiscard]] virtual unsigned int random_seed() const = 0; }; -using ISeedGeneratorFactory = std::function()>; +using ISeedGeneratorFactory = std::shared_ptr (*)(); /** * Pseudo-random unsigned integer generator. @@ -32,4 +31,4 @@ public: }; using IRandomNumberGeneratorFactory = - std::function(const unsigned int &seed)>; + std::shared_ptr (*)(const unsigned int &seed); diff --git a/src/interfaces/vector2.hpp b/src/interfaces/vector2.hpp index 569dc30..dfd369f 100644 --- a/src/interfaces/vector2.hpp +++ b/src/interfaces/vector2.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include class IVector2 @@ -42,5 +41,4 @@ struct IVector2Options unsigned int y; }; -using IVector2Factory = - std::function(const IVector2Options &options)>; +using IVector2Factory = std::shared_ptr (*)(const IVector2Options &options); -- cgit v1.2.3-18-g5258